Class OptimizedActivationStack<T>.StackItem
- Namespace
- Aplib.Core.Collections
- Assembly
- Aplib.Core.dll
Represents (i.e., encapsulates) an item on the activation stack.
public sealed class OptimizedActivationStack<T>.StackItem
- Inheritance
-
OptimizedActivationStack<T>.StackItem
- Inherited Members
Remarks
This class is public, because the whole stack item should be accessible from the outside to provide O(1) activation of a stack item with Activate(StackItem).
Constructors
StackItem(T, OptimizedActivationStack<T>)
Creates a stack item for the OptimizedActivationStack<T> class.
public StackItem(T data, OptimizedActivationStack<T> activationStack)
Parameters
dataTThe data to put on the stack.
activationStackOptimizedActivationStack<T>The activation stack instance that this stack item belongs to.
Properties
ActivationStack
Gets the activation stack instance that this stack item belongs to.
public OptimizedActivationStack<T> ActivationStack { get; }
Property Value
Data
Gets the data that this stack item represents.
public T Data { get; }
Property Value
- T
IsActive
Gets or sets a value indicating whether the item is currently on the stack.
public bool IsActive { get; set; }
Property Value
Next
Gets or sets the next (above) item on the stack.
public OptimizedActivationStack<T>.StackItem? Next { get; set; }
Property Value
Previous
Gets or sets the previous (below) item on the stack.
public OptimizedActivationStack<T>.StackItem? Previous { get; set; }
Property Value
Methods
PushOnStackAfter(StackItem)
Pushes an item that is not on the stack yet after another item that is already on the stack.
public void PushOnStackAfter(OptimizedActivationStack<T>.StackItem item)
Parameters
itemOptimizedActivationStack<T>.StackItemAn item that is already on the stack.
Exceptions
- ArgumentException
Thrown when an item is pushed after an item that is not on the same stack, when an item is already on the stack, or when an item is pushed after an item that is not on the stack.
RemoveFromStack()
Safely remove the item from the stack.
public void RemoveFromStack()