Package gov.usgs.earthquake.nshmp.tree
Class Trees
- java.lang.Object
-
- gov.usgs.earthquake.nshmp.tree.Trees
-
public class Trees extends Object
Factory class for manipulating and querying logic trees.- Author:
- U.S. Geological Survey
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static <T> LogicTree<List<T>>
transpose(List<LogicTree<T>> treeList)
Transpose a list of logic trees to a new logic tree of immutable lists.
-
-
-
Method Detail
-
transpose
public static <T> LogicTree<List<T>> transpose(List<LogicTree<T>> treeList)
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
-
-