diff --git a/src/main/java/gov/usgs/earthquake/nshmp/tree/GroupBranch.java b/src/main/java/gov/usgs/earthquake/nshmp/tree/GroupBranch.java index 129e37bbc9ea241a92a75c02f2ddd079a677fc1f..a7396550e4cd17ed0d58c6d253d4ede2b73cf3f9 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/tree/GroupBranch.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/tree/GroupBranch.java @@ -1,7 +1,7 @@ package gov.usgs.earthquake.nshmp.tree; import static com.google.common.base.Preconditions.checkNotNull; -import static gov.usgs.earthquake.nshmp.data.DoubleData.checkIsPositiveAndReal; +import static gov.usgs.earthquake.nshmp.data.DoubleData.checkIsPositiveAndRealOrZero; import static gov.usgs.earthquake.nshmp.tree.RegularBranch.checkId; /** @@ -18,7 +18,7 @@ class GroupBranch<T> implements Branch<T> { GroupBranch(String id, T value, double scale) { this.id = checkId(id); this.value = checkNotNull(value); - this.scale = checkIsPositiveAndReal(scale); + this.scale = checkIsPositiveAndRealOrZero(scale); } @Override diff --git a/src/main/java/gov/usgs/earthquake/nshmp/tree/LogicGroup.java b/src/main/java/gov/usgs/earthquake/nshmp/tree/LogicGroup.java index 5e24420dd6348e8b9718ce9090745816cdfc4d7b..7aef6c7f010a10eab8dec014e71a4f199f2d9aab 100644 --- a/src/main/java/gov/usgs/earthquake/nshmp/tree/LogicGroup.java +++ b/src/main/java/gov/usgs/earthquake/nshmp/tree/LogicGroup.java @@ -15,7 +15,8 @@ import java.util.List; * implements {@code LogicTree}, its sampling methods are overriden to throw an * {@code UnsupportedOperationException}. A logic group branch <i>may</i> * include a scale factor that is used in lieu of a branch weight; in most - * real-world cases, the scale value is one. + * real-world cases, the scale value is one. The scale factor may also be zero + * to represent {@code null} branches. * * @param <T> the type of value stored in a branch * @author U.S. Geological Survey @@ -97,7 +98,7 @@ public final class LogicGroup<T> extends AbstractList<Branch<T>> implements Logi * * @param id of the branch * @param value of the branch - * @param scale factor to apply in lieu of a branch weight + * @param scale factor to apply in lieu of a branch weight, may be zero * @return this {@code Builder} object * @throws NullPointerException if {@code id} or {@code value} is null * @throws IllegalArgumentException if {@code id} is empty or whitespace