C# Класс 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.

Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
buckets System.Collections.Hashtable

Защищенные свойства (Protected)

Свойство Тип Описание
count int

Открытые методы

Метод Описание
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.

Описание методов

Clear() публичный Метод

Clears this map of all contained objects.
public Clear ( ) : void
Результат void

Clear() публичный Метод

Clears the bucket with given key.
public Clear ( object key ) : void
key object
Результат void

Count() публичный Метод

Gets the count of objects mapped to the specified key.
public Count ( object key ) : int
key object
Результат int

Find() публичный Метод

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.
Результат IEnumerator

FindBucket() публичный Метод

public FindBucket ( object key ) : IList
key object
Результат IList

FindFirst() публичный Метод

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.
Результат object

GetBucketEnumerator() публичный Метод

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
Результат IEnumerator

Insert() публичный Метод

Inserts a value into a bucket that is specified by the key.
public Insert ( object key, object val ) : void
key object
val object
Результат void

Map() публичный Метод

Default constructor.
public Map ( ) : System
Результат System

Описание свойств

buckets публичное свойство

A list of buckets.
public Hashtable,System.Collections buckets
Результат System.Collections.Hashtable

count защищенное свойство

Number of total items currently in this map.
protected int count
Результат int