Skip to content
Snippets Groups Projects
Commit 3c4c4974 authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

allowing logicGroup branch scale to be zero

parent 20bde955
No related branches found
No related tags found
1 merge request!277mfd-tree and text updates
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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment