Class UniqueNameMap<T>
Generates a unique name for every value that is given to it. Generated names are stored. Requesting a name for the same object more than once always results in the same unique name.
Inheritance
Inherited Members
Namespace: Flame.Collections
Assembly: Flame.dll
Syntax
public sealed class UniqueNameMap<T>
Type Parameters
Name | Description |
---|---|
T | The type of value to generate names for. |
Constructors
| Improve this Doc View SourceUniqueNameMap(UniqueNameSet<T>)
Creates a unique name map from a unique name set.
Declaration
public UniqueNameMap(UniqueNameSet<T> nameSet)
Parameters
Type | Name | Description |
---|---|---|
UniqueNameSet<T> | nameSet | A pre-existing unique name set to use. |
UniqueNameMap(Func<T, String>, Func<T, Int32, String>)
Creates a unique name map from a particular name-providing function and a name-generating function that is used to resolve collisions.
Declaration
public UniqueNameMap(Func<T, string> getName, Func<T, int, string> generateName)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, System.String> | getName | A function that maps values to their preferred names. |
System.Func<T, System.Int32, System.String> | generateName | A function that takes a value and an integer and combines them into a name. This function is called with increasingly large integers when a collision occurs, until a unique name is found. |
UniqueNameMap(Func<T, String>, String)
Creates a unique name map from a particular name-providing function and a prefix that is used to resolve collisions.
Declaration
public UniqueNameMap(Func<T, string> getName, string prefix)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T, System.String> | getName | A function that maps values to their preferred names. |
System.String | prefix | A string prefix that is used to generate a unique name when a collision occurs. |
Properties
| Improve this Doc View SourceItem[T]
Gets the name that the given element is mapped to.
Declaration
public string this[T element] { get; }
Parameters
Type | Name | Description |
---|---|---|
T | element |
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceGet(T)
Gets the name that the given element is mapped to.
Declaration
public string Get(T element)
Parameters
Type | Name | Description |
---|---|---|
T | element |
Returns
Type | Description |
---|---|
System.String |