Class CmsPathTree<P,V>

java.lang.Object
org.opencms.util.CmsPathTree<P,V>
Type Parameters:
P - the type of path components
V - the element type stored in the tree

public class CmsPathTree<P,V> extends Object
Tree used to represent file system like data structures.

A tree consists of a (possibly empty) value and a map from child names to subtrees.

  • Constructor Details

  • Method Details

    • collectEntries

      public void collectEntries(Collection<V> target)
      Collect all descendant values in the given collection.

      Parameters:
      target - the collection in which to store the descendant values
    • findNode

      public CmsPathTree<P,V> findNode(List<P> path)
      Finds the node for the given path, and returns it or null if node was found.

      Parameters:
      path - the path
      Returns:
      the node for the path
    • getChild

      public CmsPathTree<P,V> getChild(P pathPart)
      Gets the child for the given path component.

      Parameters:
      pathPart - the path component
      Returns:
      the child for the given path component (may be null)
    • getChildValues

      public List<V> getChildValues()
      Returns the values for the direct children of this node.

      Returns:
      the values for the direct children
    • getChildValues

      public List<V> getChildValues(List<P> path)
      Gets the child values for the given path.

      Parameters:
      path - the path
      Returns:
      the child values
    • getDescendantValues

      public List<V> getDescendantValues(List<P> path)
      Gets the descendant values.

      Parameters:
      path - the path
      Returns:
      the descendant values
    • getValue

      public V getValue()
      Gets the value for this node (may be null).

      Returns:
      the value
    • getValue

      public V getValue(List<P> path)
      Gets the value for the sub-path given, starting from this node.

      Parameters:
      path - the path
      Returns:
      the value for the node
    • setValue

      public void setValue(List<P> path, V value)
      Sets the value for the sub-path given, starting from this node.

      Parameters:
      path - the path
      value - the value to set
    • setValue

      public void setValue(V value)
      Sets the value for this node.

      Parameters:
      value - the value for the node