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

A list of items that is unordered. This provides O(1) addition, O(1) removal, and O(1) iteration. However, having all of these nice properties requires some metadata to be stored on each item, which means that Add takes a parameter of metadata for the stored item. Same with remove. More...

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

Public Member Functions

 UnorderedList (int capacity=8)
 Creates a new UnorderedList with the given capacity. More...
 
bool Contains (T item, UnorderedListMetadata metadata)
 Checks to see if the given item is contained in the UnorderedList. This is O(1). More...
 
bool Remove (T item, UnorderedListMetadata metadata)
 Removes the stored item. More...
 
void Add (T item, UnorderedListMetadata metadata)
 Adds an item to the list. The location of the item in the list is unspecified. More...
 
IEnumerator< T > GetEnumerator ()
 

Properties

int Length [get, set]
 The number of stored objects in Items. More...
 
this[int index] [get, set]
 Set or get the item at the specified index. More...
 

Detailed Description

A list of items that is unordered. This provides O(1) addition, O(1) removal, and O(1) iteration. However, having all of these nice properties requires some metadata to be stored on each item, which means that Add takes a parameter of metadata for the stored item. Same with remove.

Template Parameters
TThe type of item to store.

Constructor & Destructor Documentation

Forge.Collections.UnorderedList< T >.UnorderedList ( int  capacity = 8)

Creates a new UnorderedList with the given capacity.

Parameters
capacityThe capacity to give to the list

Member Function Documentation

void Forge.Collections.UnorderedList< T >.Add ( item,
UnorderedListMetadata  metadata 
)

Adds an item to the list. The location of the item in the list is unspecified.

bool Forge.Collections.UnorderedList< T >.Contains ( item,
UnorderedListMetadata  metadata 
)

Checks to see if the given item is contained in the UnorderedList. This is O(1).

Parameters
itemThe item to check
metadataThe item's metadata
Returns
True if the item is contained, false otherwise
bool Forge.Collections.UnorderedList< T >.Remove ( item,
UnorderedListMetadata  metadata 
)

Removes the stored item.

Returns
True if the item was removed, false otherwise

Property Documentation

int Forge.Collections.UnorderedList< T >.Length
getset

The number of stored objects in Items.

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

Set or get the item at the specified index.


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