Show / Hide Table of Contents

Class CollapsingStateStack<T>

An IStateStack implementation behaving better in situations where many subsequent Push (and Pop) operations occur without actually altering the TOS contents.

Inheritance
System.Object
CollapsingStateStack<T>
Implements
IStateStack
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fusee.Xene
Assembly: Fusee.Xene.dll
Syntax
public class CollapsingStateStack<T> : IStateStack
Type Parameters
Name Description
T
Remarks

Using instances of this class is recommended if the Type parameter is a large value type. Defines the Tos property granting read and write access the current Top of stack. The type of the entries stored within the stack.

Constructors

CollapsingStateStack(Int32)

Initializes a new instance of the CollapsingStateStack<T> class.

Declaration
public CollapsingStateStack(int capacity = 4)
Parameters
Type Name Description
System.Int32 capacity

The initial capacity of the stack. This is the expected maximum stack depth. If the stack depth grows bigger, the stack automatically doubles its capacity internally.

Properties

Depth

Retrieves the stack's depth.

Declaration
public int Depth { get; }
Property Value
Type Description
System.Int32

The current depth of the stack.

Tos

Gets and sets the Top of stack.

Declaration
public T Tos { get; set; }
Property Value
Type Description
T

The top of stack.

Methods

Clear()

Clears the stack. The Depth will be reset to zero.

Declaration
public void Clear()

Pop()

The stack's Pop operation. Decreases the stack Depth about one and restores the previous state.

Declaration
public void Pop()
Exceptions
Type Condition
System.InvalidOperationException

CollapsingState Stack depth is already 0. Cannot Pop stack.

Push()

The stack's Push operation. Increases the stack Depth about one and copies the top of stack.

Declaration
public void Push()

Implements

IStateStack
Generated by DocFX
GitHub Repo
Back to top