java.lang.Object
org.litebridge.orm.engine.compiler.ContextStack<T>
- Type Parameters:
T- The type of the context objects managed by this stack.
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 -
Method Summary
Modifier and TypeMethodDescriptionall()Returns all stored instances in the context stack.voidclear()Clears all stored instances from the context stack.current()Retrieves the current context object from the stack.booleanisEmpty()Checks if the context stack is empty.protected abstract TCreates a new root instance for the context stack.protected abstract TnewSubInstance(LogicOperator logicOperator) Creates a new child instance in the context stack.voidpop()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.
-
Constructor Details
-
ContextStack
public ContextStack()
-
-
Method Details
-
newRootInstance
Creates a new root instance for the context stack.- Returns:
- The new root instance.
-
newSubInstance
Creates a new child instance in the context stack.- Returns:
- The new child instance.
-
current
Retrieves the current context object from the stack.- Returns:
- The current context object.
-
push
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
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
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
-