Class Hierarchy<T>

java.lang.Object
org.evrete.util.Hierarchy<T>
Type Parameters:
T - the type of the value stored in the hierarchy nodes

public class Hierarchy<T> extends Object
The Hierarchy class represents a hierarchical structure of elements.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Hierarchy(T value)
    Constructs a Hierarchy root node.
    Hierarchy(T value, Hierarchy<T> parent)
    Constructs a Hierarchy with a specified value and an optional parent.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the current node.
    final void
    walkUp(Consumer<T> consumer)
    Walks up the hierarchy, starting from the current node and applying the given consumer to each node's value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Hierarchy

      public Hierarchy(T value, Hierarchy<T> parent)
      Constructs a Hierarchy with a specified value and an optional parent.
      Parameters:
      value - the value of the current node
      parent - the parent node, can be null
    • Hierarchy

      public Hierarchy(T value)
      Constructs a Hierarchy root node.
      Parameters:
      value - the value of the current node
  • Method Details

    • getValue

      public T getValue()
      Returns the value of the current node.
      Returns:
      the value of the current node
    • walkUp

      public final void walkUp(Consumer<T> consumer)
      Walks up the hierarchy, starting from the current node and applying the given consumer to each node's value.
      Parameters:
      consumer - a Consumer to apply to each node's value