Class StackArray<T>
Implements a First-In-Last-Out stack data structure using an array.
Inheritance
Implements
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class StackArray<T> : object, IStack<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.ICountable, DataStructure.IClearable, ICloneable<StackArray<T>>
Type Parameters
Name | Description |
---|---|
T | The generic type within the structure. |
Constructors
| Improve this Doc View SourceStackArray()
Constructs a new stack.
Declaration
public StackArray()
StackArray(Int32)
Constructs a new stack.
Declaration
public StackArray(int minimumCapacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | minimumCapacity | The minimum capacity of the stack. |
Properties
| Improve this Doc View SourceCount
Gets the current count of the data structure.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
CurrentCapacity
Gets the current capacity of the list.
Declaration
public int CurrentCapacity { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
MinimumCapacity
Allows you to adjust the minimum capacity of this list.
Declaration
public int? MinimumCapacity { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
Methods
| Improve this Doc View SourceClear()
Returns the data structure to an empty state.
Declaration
public void Clear()
Clone()
Clones a T
.
Declaration
public StackArray<T> Clone()
Returns
Type | Description |
---|---|
StackArray<T> | A clone of the |
GetEnumerator()
Declaration
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> |
Peek()
Returns the most recent addition to the stack.
Declaration
public T Peek()
Returns
Type | Description |
---|---|
T | The most recent addition to the stack. |
Pop()
Removes and returns the most recent addition to the stack.
Declaration
public T Pop()
Returns
Type | Description |
---|---|
T | The most recent addition to the stack. |
Push(T)
Adds an item to the top of the stack.
Declaration
public void Push(T addition)
Parameters
Type | Name | Description |
---|---|---|
T | addition |
StepperBreak<TStep>(TStep)
Traverses values and invokes a function on every T
value.
Declaration
public StepStatus StepperBreak<TStep>(TStep step = default(TStep))
where TStep : struct, IFunc<T, StepStatus>
Parameters
Type | Name | Description |
---|---|---|
TStep | step | The function to invoke on every |
Returns
Type | Description |
---|---|
StepStatus | The status of the traversal. |
Type Parameters
Name | Description |
---|---|
TStep | The type of function to invoke on every |
ToArray()
Constructs an array with the values of this data structure.
Declaration
public T[] ToArray()
Returns
Type | Description |
---|---|
T[] | An array with the values of this data structure. |