Class SparseCellDataStructure<TSourceKey, TDataValue>
An hierarchical dataValue structure to store dataValues.
Namespace: Holoride.ElasticSDK
Assembly: Holoride.ElasticSDK.Library.Runtime.dll
Syntax
public class SparseCellDataStructure<TSourceKey, TDataValue>
Type Parameters
Name | Description |
---|---|
TSourceKey | The type used as a key to relate objects to their generation source. |
TDataValue | The type of the stored cell values. |
Properties
Sources
Gets a list of all sources.
Declaration
public IEnumerable<TSourceKey> Sources { get; }
Property Value
Type | Description |
---|---|
IEnumerable<TSourceKey> |
Methods
AddDataBySource(TSourceKey, IEnumerable<TDataValue>, DataValueToCellKeyDelegate)
Adds a list of dataValues with reference to their source.
Declaration
public void AddDataBySource(TSourceKey source, IEnumerable<TDataValue> dataValues, SparseCellDataStructure<TSourceKey, TDataValue>.DataValueToCellKeyDelegate dataValueToCellKeyFunction)
Parameters
Type | Name | Description |
---|---|---|
TSourceKey | source | The source of the dataValues. |
IEnumerable<TDataValue> | dataValues | The dataValues to add. |
SparseCellDataStructure<TSourceKey, TDataValue>.DataValueToCellKeyDelegate | dataValueToCellKeyFunction | Function that maps data values to cell keys. |
Clear()
Clears the data structure.
Declaration
public void Clear()
Contains(TSourceKey)
States whether dataValues generated by a certain source are contained.
Declaration
public bool Contains(TSourceKey sourceKey)
Parameters
Type | Name | Description |
---|---|---|
TSourceKey | sourceKey | The source key. |
Returns
Type | Description |
---|---|
bool | Whether dataValues generated by a certain source are contained. |
ForEachDataValueInCell(Vector2Int, Action<TDataValue>)
Calls a function on all dataValues within a cell.
Declaration
public void ForEachDataValueInCell(Vector2Int cellKey, Action<TDataValue> function)
Parameters
Type | Name | Description |
---|---|---|
Vector2Int | cellKey | The key of the cell. |
Action<TDataValue> | function | The function to call. |
GetDataInCell(Vector2Int)
Gets a enumerable of all dataValues within a cell.
Declaration
public IEnumerable<TDataValue> GetDataInCell(Vector2Int cellKey)
Parameters
Type | Name | Description |
---|---|---|
Vector2Int | cellKey | The key of the cell. |
Returns
Type | Description |
---|---|
IEnumerable<TDataValue> | Returns a collection of cell data for specified cell keys of all generation contexts. |
RemoveDataBySource(TSourceKey)
Removes all dataValues created by the given source.
Declaration
public void RemoveDataBySource(TSourceKey source)
Parameters
Type | Name | Description |
---|---|---|
TSourceKey | source | The source of the dataValues. |
RemoveDataFromOtherSources(TSourceKey)
Removes all dataValues created by any source other than the given source.
Declaration
public void RemoveDataFromOtherSources(TSourceKey remainingSource)
Parameters
Type | Name | Description |
---|---|---|
TSourceKey | remainingSource | The source of the dataValues to remain. |