Package gov.usgs.earthquake.nshmp.tree
Class LogicTree.Builder<T>
java.lang.Object
gov.usgs.earthquake.nshmp.tree.LogicTree.Builder<T>
- Direct Known Subclasses:
LogicGroup.Builder,LogicTree.EnumBuilder,LogicTree.EnumValueBuilder,LogicTree.StringValueBuilder
A single-use
LogicTree builder.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSole package constructor; useLogicTree.builder(String)instead. -
Method Summary
-
Constructor Details
-
Builder
Sole package constructor; useLogicTree.builder(String)instead.- Parameters:
name- of the tree
-
-
Method Details
-
addBranch
Add a branch to the tree.- Parameters:
id- of the branchvalue- of the branchweight- of the branch- Returns:
- this
Builderobject - Throws:
NullPointerException- ifidorvalueis nullIllegalArgumentException- ifidis empty or whitespaceIllegalArgumentException- if a branch withidhas already been addedIllegalArgumentException- ifweightis outside the range (0..1]
-
build
Return a newly createdLogicTree.- Throws:
IllegalStateException- if this method has already been calledIllegalStateException- if the logic tree is empty (i.e. no branches have been added)IllegalStateException- if branch weights do not sum to1.0 ± 0.00001
-