Package eu.bandm.tools.paisley
Class EnumBranch.Builder<A,E extends Enum<E>>
java.lang.Object
eu.bandm.tools.paisley.EnumBranch.Builder<A,E>
- Type Parameters:
A- the target type of objects to match againstE- the enum type to index the branches
- Enclosing class:
EnumBranch<A,E extends Enum<E>>
Incremental builder.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Builder
Creates a new empty builder.- Parameters:
cls- the enum class to use for keys- Throws:
NullPointerException- ifclsis null
-
Builder
Creates a new builder with a single branch.- Parameters:
key- the key of the branchsubpattern- the subpattern of the branch- Throws:
NullPointerException- ifkeyorsubpatternis null
-
-
Method Details
-
put
Adds a new branch to this builder.This method uses
Map.put(K, V)internally; if a branch with the given key already exists, it is overwritten.- Parameters:
key- the key for the new branchsubpattern- the subpattern for the new branch- Returns:
this- Throws:
NullPointerException- ifkeyorsubpatternis null
-
clear
public void clear()Removes all branches of this builder. -
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
-