ForgeDocs
Documentation for the forge framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Forge.Collections.SparseArray< T > Class Template Reference

Stores a list of items where the are gaps between items; not every index in the array contains an element. More...

Inheritance diagram for Forge.Collections.SparseArray< T >:

Public Member Functions

 SparseArray ()
 Creates a new SparseArray with the default capacity. More...
 
 SparseArray (int capacity)
 Creates a new SparseArray with the given capacity. More...
 
 SparseArray (IEnumerable< KeyValuePair< int, T >> enumerator)
 Creates a new sparse array from the given enumerator. More...
 
void Clear ()
 Clears out all elements inside of the SparseArray. More...
 
bool Remove (int index)
 Removes the element at the given index. More...
 
bool ContainsKey (int index)
 Checks to see if there is an element at the given index. More...
 
bool TryGetValue (int key, out T value)
 Gets the value associated with the specified key. More...
 
IEnumerator< KeyValuePair< int,
T > > 
GetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 

Properties

this[int index] [get, set]
 Gets or sets the element at the given index. More...
 

Detailed Description

Stores a list of items where the are gaps between items; not every index in the array contains an element.

Constructor & Destructor Documentation

Forge.Collections.SparseArray< T >.SparseArray ( )

Creates a new SparseArray with the default capacity.

Forge.Collections.SparseArray< T >.SparseArray ( int  capacity)

Creates a new SparseArray with the given capacity.

Parameters
capacityThe capacity to initialize with
Forge.Collections.SparseArray< T >.SparseArray ( IEnumerable< KeyValuePair< int, T >>  enumerator)

Creates a new sparse array from the given enumerator.

Parameters
enumeratorThe items to allocate the array from.

Member Function Documentation

void Forge.Collections.SparseArray< T >.Clear ( )

Clears out all elements inside of the SparseArray.

bool Forge.Collections.SparseArray< T >.ContainsKey ( int  index)

Checks to see if there is an element at the given index.

Parameters
indexThe index to check.
Returns
True if there is a contained element, false otherwise.
IEnumerator<KeyValuePair<int, T> > Forge.Collections.SparseArray< T >.GetEnumerator ( )

Returns an enumerator that iterates through the collection.

bool Forge.Collections.SparseArray< T >.Remove ( int  index)

Removes the element at the given index.

Parameters
indexThe index of the element to remove
Returns
If an element was removed
bool Forge.Collections.SparseArray< T >.TryGetValue ( int  key,
out T  value 
)

Gets the value associated with the specified key.

Parameters
keyThe key whose value to get.
valueWhen this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
Returns
true if the object that implements T:System.Collections.Generic.IDictionary`2 contains an element with the specified key; otherwise, false.

Property Documentation

T Forge.Collections.SparseArray< T >.this[int index]
getset

Gets or sets the element at the given index.

Parameters
indexThe index to set
Returns
If getting, then the value at the given index.

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