Class TreeReplace<T>

java.lang.Object
org.aksw.commons.collections.trees.TreeBase<T>
org.aksw.commons.collections.trees.TreeReplace<T>
Type Parameters:
T -
All Implemented Interfaces:
Tree<T>

public class TreeReplace<T> extends TreeBase<T>
Tree wrapper with bidirectional replacement of certain nodes with leaf nodes. Useful to replace sub-trees with single nodes.
Author:
raven
  • Field Details

    • delegate

      protected Tree<T> delegate
    • delegateToReplacement

      protected Map<T,T> delegateToReplacement
    • replacementToDelegate

      protected Map<T,T> replacementToDelegate
  • Constructor Details

    • TreeReplace

      public TreeReplace(Tree<T> delegate, Map<T,T> delegateToReplacement, Map<T,T> replacementToDelegate)
  • Method Details

    • getRoot

      public T getRoot()
    • getChildren

      public List<T> getChildren(T b)
    • getParent

      public T getParent(T b)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • copy

      public T copy(T node, List<T> children)
      Description copied from interface: Tree
      Copies a given node thereby setting the provided children as its children.
      Returns:
      A copy of the given node with the children set appropriately
    • createNew

      public Tree<T> createNew(T root)