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 Details

    • 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 tree
      R - the value type of the transformed logic tree
      Parameters:
      tree - to transform
      function - to apply
      name - optional new name for the transformed tree; if empty the name of the supplied tree is used