![]() |
Infohazard.Core 1.4.1
Infohazard Core Utility Library
|
A FIFO data structure similar to a Queue, except that it implements all List operations. More...
Public Member Functions | |
ListQueue (int initialCapacity=32) | |
Construct a new ListQueue with the given capacity. More... | |
ListQueue (IEnumerable< T > enumerable) | |
Construct a new ListQueue containing all the elements of the given sequence. More... | |
void | Enqueue (T item) |
Add an item to the front of the queue. More... | |
void | EnsureCapacity (int capacity) |
Ensures that the capacity of the queue is at least the given value, and grows if not. More... | |
T | Peek () |
Returns the element at the front of the queue without removing it. More... | |
bool | TryPeek (out T item) |
Get the element at the front of the queue if it is not empty, and return whether this was successful. More... | |
T | Dequeue () |
Removes and returns the element at the front of the queue. More... | |
bool | TryDequeue (out T item) |
Get the element at the front of the queue if it is not empty, remove it, and return whether this was successful. More... | |
IEnumerator< T > | GetEnumerator () |
void | Add (T item) |
void | Clear () |
bool | Contains (T item) |
void | CopyTo (T[] array, int arrayIndex) |
bool | Remove (T item) |
int | IndexOf (T item) |
void | Insert (int index, T item) |
void | RemoveAt (int index) |
void | RemoveRange (int index, int count) |
Removes a range of items from the queue. More... | |
Properties | |
int | Count [get, private set] |
int | Capacity [get] |
Current capacity, which will be automatically expanded when needed. More... | |
bool | IsReadOnly [get] |
T | this[int index] [get, set] |
A FIFO data structure similar to a Queue, except that it implements all List operations.
This enables much greater flexibility than the builtin .NET Queue class. Unlike a List, it has O(1) performance for both Enqueue and Dequeue operations (assuming there is enough room).
T | Type of elements in the structure. |
Infohazard.Core.ListQueue< T >.ListQueue | ( | int | initialCapacity = 32 | ) |
Construct a new ListQueue with the given capacity.
initialCapacity | Initial capacity, which will be expanded as needed. |
Infohazard.Core.ListQueue< T >.ListQueue | ( | IEnumerable< T > | enumerable | ) |
Construct a new ListQueue containing all the elements of the given sequence.
enumerable | Sequence to initialize the queue. |
void Infohazard.Core.ListQueue< T >.Add | ( | T | item | ) |
void Infohazard.Core.ListQueue< T >.Clear | ( | ) |
bool Infohazard.Core.ListQueue< T >.Contains | ( | T | item | ) |
void Infohazard.Core.ListQueue< T >.CopyTo | ( | T[] | array, |
int | arrayIndex | ||
) |
T Infohazard.Core.ListQueue< T >.Dequeue | ( | ) |
Removes and returns the element at the front of the queue.
InvalidOperationException | If the queue is empty. |
void Infohazard.Core.ListQueue< T >.Enqueue | ( | T | item | ) |
Add an item to the front of the queue.
The capacity of the queue will be grown if needed.
item | The item to add. |
void Infohazard.Core.ListQueue< T >.EnsureCapacity | ( | int | capacity | ) |
Ensures that the capacity of the queue is at least the given value, and grows if not.
capacity | The capacity to ensure. |
IEnumerator< T > Infohazard.Core.ListQueue< T >.GetEnumerator | ( | ) |
int Infohazard.Core.ListQueue< T >.IndexOf | ( | T | item | ) |
void Infohazard.Core.ListQueue< T >.Insert | ( | int | index, |
T | item | ||
) |
T Infohazard.Core.ListQueue< T >.Peek | ( | ) |
Returns the element at the front of the queue without removing it.
InvalidOperationException | If the queue is empty. |
bool Infohazard.Core.ListQueue< T >.Remove | ( | T | item | ) |
void Infohazard.Core.ListQueue< T >.RemoveAt | ( | int | index | ) |
void Infohazard.Core.ListQueue< T >.RemoveRange | ( | int | index, |
int | count | ||
) |
Removes a range of items from the queue.
index | The first index to remove. |
count | The number of items to remove. |
bool Infohazard.Core.ListQueue< T >.TryDequeue | ( | out T | item | ) |
Get the element at the front of the queue if it is not empty, remove it, and return whether this was successful.
item | The item at the front of the queue. |
bool Infohazard.Core.ListQueue< T >.TryPeek | ( | out T | item | ) |
Get the element at the front of the queue if it is not empty, and return whether this was successful.
item | The item at the front of the queue. |
|
get |
Current capacity, which will be automatically expanded when needed.
Expanding capacity is an O(n) operation, so it should be avoided when possible.
|
getprivate set |
|
get |
|
getset |