Class ContextStack<T>

java.lang.Object
org.litebridge.orm.engine.compiler.ContextStack<T>
Type Parameters:
T - The type of the context objects managed by this stack.

public abstract class ContextStack<T> extends Object
An abstract stack used to manage a hierarchical context structure.

This class provides mechanisms to maintain a stack of context objects and their associated hierarchical relationships.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    all()
    Returns all stored instances in the context stack.
    void
    Clears all stored instances from the context stack.
    Retrieves the current context object from the stack.
    boolean
    Checks if the context stack is empty.
    protected abstract T
    Creates a new root instance for the context stack.
    protected abstract T
    Creates a new child instance in the context stack.
    void
    pop()
    Removes the topmost child instance from the context stack.
    push(LogicOperator logicOperator)
    Pushes a new child instance onto the context stack.
    push(LogicOperator logicOperator, T subgroup)
    Pushes a new child instance onto the context stack.

    Methods inherited from class java.lang.Object

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

    • ContextStack

      public ContextStack()
  • Method Details

    • newRootInstance

      protected abstract T newRootInstance()
      Creates a new root instance for the context stack.
      Returns:
      The new root instance.
    • newSubInstance

      protected abstract T newSubInstance(LogicOperator logicOperator)
      Creates a new child instance in the context stack.
      Returns:
      The new child instance.
    • current

      public T current()
      Retrieves the current context object from the stack.
      Returns:
      The current context object.
    • push

      public T push(LogicOperator logicOperator)
      Pushes a new child instance onto the context stack.
      Parameters:
      logicOperator - The logic operator to combine the new child instance with the current stack.
      Returns:
      The new child instance.
    • push

      public T push(LogicOperator logicOperator, T subgroup)
      Pushes a new child instance onto the context stack.
      Parameters:
      logicOperator - The logic operator to combine the new child instance with the current stack.
      subgroup - The new child instance to push onto the stack.
      Returns:
      The new child instance.
    • pop

      public void pop()
      Removes the topmost child instance from the context stack.
    • all

      public List<T> all()
      Returns all stored instances in the context stack.
      Returns:
      A list of all stored instances.
    • isEmpty

      public boolean isEmpty()
      Checks if the context stack is empty.
      Returns:
      True if the stack is empty, false otherwise.
    • clear

      public void clear()
      Clears all stored instances from the context stack.
      Since:
      0.5.1