Dungeon Architect  17.0.0
SharpNav.Collections.Generic.BufferedStack< T > Class Template Reference

Typical FIFO generic stack container that stores data inside of a fixed-size internal buffer (array). More...

Inheritance diagram for SharpNav.Collections.Generic.BufferedStack< T >:

Public Member Functions

 BufferedStack (int size)
 Initializes a new instance of the BufferedStack<T> class. More...
 
 BufferedStack (int size, ICollection< T > items)
 Initializes a new instance of the BufferedStack<T> class as a copy of an ICollection<T> of the same type. More...
 
bool Push (T item)
 Pushes a new element to the top of the stack. More...
 
Pop ()
 Removes most recent (top) element from stack and returns it. More...
 
Peek ()
 Returns copy of the top element of the stack. More...
 
void Clear ()
 Resets stack pointer back to default, essentially clearing the stack. More...
 
bool Contains (T item)
 Returns whether the stack contains a given item. More...
 
void CopyTo (T[] array, int arrayIndex)
 Copies the contents of the BufferedStack<T> to an array. More...
 
IEnumerator< T > GetEnumerator ()
 Gets the BufferedStack's enumerator. More...
 

Properties

int Count [get]
 Gets the number of elements in the stack. More...
 
this[int index] [get]
 Gets the value at specified index (valid ranges are from 0 to size-1) More...
 

Detailed Description

Typical FIFO generic stack container that stores data inside of a fixed-size internal buffer (array).

Template Parameters
TType of element that given BufferedStack object stores.

Definition at line 16 of file BufferedStack.cs.

Constructor & Destructor Documentation

◆ BufferedStack() [1/2]

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

Parameters
sizeThe maximum number of items that will be stored.

Definition at line 25 of file BufferedStack.cs.

◆ BufferedStack() [2/2]

SharpNav.Collections.Generic.BufferedStack< T >.BufferedStack ( int  size,
ICollection< T >  items 
)

Initializes a new instance of the BufferedStack<T> class as a copy of an ICollection<T> of the same type.

Parameters
sizeThe number of elements to copy from the collection.
itemsThe collection to copy from.

Definition at line 37 of file BufferedStack.cs.

Member Function Documentation

◆ Clear()

Resets stack pointer back to default, essentially clearing the stack.

Definition at line 127 of file BufferedStack.cs.

◆ Contains()

bool SharpNav.Collections.Generic.BufferedStack< T >.Contains ( item)

Returns whether the stack contains a given item.

Parameters
itemItem to search for
Returns
True if item exists in stack, False if not

Definition at line 137 of file BufferedStack.cs.

◆ CopyTo()

void SharpNav.Collections.Generic.BufferedStack< T >.CopyTo ( T[]  array,
int  arrayIndex 
)

Copies the contents of the BufferedStack<T> to an array.

Parameters
arrayThe array to copy to.
arrayIndexThe index within the array to start copying to.

Definition at line 151 of file BufferedStack.cs.

◆ GetEnumerator()

IEnumerator<T> SharpNav.Collections.Generic.BufferedStack< T >.GetEnumerator ( )

Gets the BufferedStack's enumerator.

Returns
The enumerator.

Definition at line 160 of file BufferedStack.cs.

◆ Peek()

Returns copy of the top element of the stack.

Returns
Top element

Definition at line 116 of file BufferedStack.cs.

◆ Pop()

Removes most recent (top) element from stack and returns it.

Returns
Top element

Definition at line 104 of file BufferedStack.cs.

◆ Push()

bool SharpNav.Collections.Generic.BufferedStack< T >.Push ( item)

Pushes a new element to the top of the stack.

Parameters
itemThe element to be added to the stack
Returns
True if element was added to stack, False otherwise

Definition at line 92 of file BufferedStack.cs.

Property Documentation

◆ Count

Gets the number of elements in the stack.

Definition at line 55 of file BufferedStack.cs.

◆ this[int index]

T SharpNav.Collections.Generic.BufferedStack< T >.this[int index]
get

Gets the value at specified index (valid ranges are from 0 to size-1)

Parameters
indexIndex value
Returns
The value at the index

Definition at line 79 of file BufferedStack.cs.


The documentation for this class was generated from the following file: