Class IntBranch.Builder<A>

java.lang.Object
eu.bandm.tools.paisley.IntBranch.Builder<A>
Type Parameters:
A - the target type of objects to match against
Enclosing class:
IntBranch<A>

public static class IntBranch.Builder<A> extends Object
Incremental builder.
  • Constructor Details

    • Builder

      public Builder()
      Creates a new empty builder.
    • Builder

      public Builder(Pattern<? super A> subpattern)
      Creates a new builder with a single branch.
      Parameters:
      subpattern - the subpattern of the branch
      Throws:
      NullPointerException - if subpattern is null
  • Method Details

    • add

      public IntBranch.Builder<A> add(Pattern<? super A> subpattern)
      Adds a next branch to this builder.

      This method uses List.add(E) internally; the new branch is assigned the next free index, which is equal to the current size of the list.

      Parameters:
      subpattern - the subpattern for the new branch
      Returns:
      this
      Throws:
      NullPointerException - if key or subpattern is null
    • clear

      public void clear()
      Removes all branches of this builder.
    • build

      public IntBranch<A> build()
      Creates a new pattern with the current content of this builder.

      After pattern creation, this builder may be reused.

      Returns:
      a pattern with the same branches as the current content of this builder