Package gov.usgs.earthquake.nshmp.tree
Class Trees
java.lang.Object
gov.usgs.earthquake.nshmp.tree.Trees
Factory class for manipulating and querying logic trees.
- Author:
- U.S. Geological Survey
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,R> LogicTree <R> Transform a logic tree with one value type into a new logic tree with a different value type, preserving branch IDs and weights.Transpose a list of logic trees to a new logic tree of immutable lists.
-
Method Details
-
transpose
Transpose a list of logic trees to a new logic tree of immutable lists. Supplied logic trees are assumed to all have same branch names, IDs and weights.- Type Parameters:
T- the value type of the supplied logic tree- Parameters:
treeList- the list of logic trees to transpose
-
transform
public static <T,R> LogicTree<R> transform(LogicTree<T> tree, Function<T, R> function, Optional<String> name) Transform a logic tree with one value type into a new logic tree with a different value type, preserving branch IDs and weights.- Type Parameters:
T- the value type of the supplied logic treeR- the value type of the transformed logic tree- Parameters:
tree- to transformfunction- to applyname- optional new name for the transformed tree; if empty the name of the supplied tree is used
-