C# Class Axiom.SceneManagers.Bsp.Collections.Map

Map class, a little different from the Axiom.Collections.Map class
A map allows multiple values per key, unlike the Hashtable which only allows unique keys and only a single value per key. Multiple values assigned to the same key are placed in a "bucket", which in this case is an ArrayList.

An example of values in a map would look like this: Key Value "a" "Alan" "a" "Adam" "b" "Brien" "c" "Chris" "c" "Carl" etc

Currently, enumeration is the only way to iterate through the values, which is more pratical in terms of how the Map works internally anyway. Intial testing showed that inserting and iterating through 100,000 items, the Inserts took ~260ms and a full enumeration of them all (with unboxing of the value type stored in the map) took between 16-30ms.

Show file Open project: WolfgangSt/axiom

Public Properties

Property Type Description
buckets System.Collections.Hashtable

Protected Properties

Property Type Description
count int

Public Methods

Method Description
Clear ( ) : void

Clears this map of all contained objects.

Clear ( object key ) : void

Clears the bucket with given key.

Count ( object key ) : int

Gets the count of objects mapped to the specified key.

Find ( object key ) : IEnumerator

Given a key, Find will return an IEnumerator that allows you to iterate over all items in the bucket associated with the key.

FindBucket ( object key ) : IList
FindFirst ( object key ) : object

Given a key, FindFirst will return the first item in the bucket associated with the key.

GetBucketEnumerator ( ) : IEnumerator

Gets an appropriate enumerator for the map, customized to go through each key in the map and return a Pair of the key and an ArrayList of the values associated with it.

Insert ( object key, object val ) : void

Inserts a value into a bucket that is specified by the key.

Map ( ) : System

Default constructor.

Method Details

Clear() public method

Clears this map of all contained objects.
public Clear ( ) : void
return void

Clear() public method

Clears the bucket with given key.
public Clear ( object key ) : void
key object
return void

Count() public method

Gets the count of objects mapped to the specified key.
public Count ( object key ) : int
key object
return int

Find() public method

Given a key, Find will return an IEnumerator that allows you to iterate over all items in the bucket associated with the key.
public Find ( object key ) : IEnumerator
key object Key for look for.
return IEnumerator

FindBucket() public method

public FindBucket ( object key ) : IList
key object
return IList

FindFirst() public method

Given a key, FindFirst will return the first item in the bucket associated with the key.
public FindFirst ( object key ) : object
key object Key to look for.
return object

GetBucketEnumerator() public method

Gets an appropriate enumerator for the map, customized to go through each key in the map and return a Pair of the key and an ArrayList of the values associated with it.
public GetBucketEnumerator ( ) : IEnumerator
return IEnumerator

Insert() public method

Inserts a value into a bucket that is specified by the key.
public Insert ( object key, object val ) : void
key object
val object
return void

Map() public method

Default constructor.
public Map ( ) : System
return System

Property Details

buckets public property

A list of buckets.
public Hashtable,System.Collections buckets
return System.Collections.Hashtable

count protected property

Number of total items currently in this map.
protected int count
return int