Class KeyedMatrix<TKeyColumn, TKeyRow, TItem>
Inheritance
KeyedMatrix<TKeyColumn, TKeyRow, TItem>
Assembly: SoCore.dll
Syntax
public class KeyedMatrix<TKeyColumn, TKeyRow, TItem> : IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>>, IEnumerable where TItem : class
Type Parameters
Name |
Description |
TKeyColumn |
|
TKeyRow |
|
TItem |
|
Constructors
KeyedMatrix()
Declaration
KeyedMatrix(IEqualityComparer<TKeyColumn>, IEqualityComparer<TKeyRow>)
Declaration
public KeyedMatrix(IEqualityComparer<TKeyColumn> columnComparer, IEqualityComparer<TKeyRow> rowComparer)
Parameters
Properties
Height
Get number of items in the vertical dimension.
Declaration
public int Height { get; }
Property Value
this[int, int]
Declaration
public MatrixItem<TKeyColumn, TKeyRow, TItem> this[int columnlIndex, int rowlIndex] { get; set; }
Parameters
Type |
Name |
Description |
int |
columnlIndex |
|
int |
rowlIndex |
|
Property Value
Type |
Description |
MatrixItem<TKeyColumn, TKeyRow, TItem> |
|
this[TKeyColumn, TKeyRow]
Declaration
public TItem this[TKeyColumn columnKey, TKeyRow rowKey] { get; set; }
Parameters
Type |
Name |
Description |
TKeyColumn |
columnKey |
|
TKeyRow |
rowKey |
|
Property Value
Width
Get number of items in the horizontal dimension.
Declaration
public int Width { get; }
Property Value
Methods
AddColumn(TKeyColumn)
Declaration
public int AddColumn(TKeyColumn columnKey)
Parameters
Type |
Name |
Description |
TKeyColumn |
columnKey |
|
Returns
AddRow(TKeyRow)
Declaration
public int AddRow(TKeyRow verticalKey)
Parameters
Type |
Name |
Description |
TKeyRow |
verticalKey |
|
Returns
AlterColumnKey(TKeyColumn, TKeyColumn)
Declaration
public void AlterColumnKey(TKeyColumn oldHorizontalKey, TKeyColumn newHorizontalKey)
Parameters
Type |
Name |
Description |
TKeyColumn |
oldHorizontalKey |
|
TKeyColumn |
newHorizontalKey |
|
AlterRowKey(TKeyRow, TKeyRow)
Declaration
public void AlterRowKey(TKeyRow oldVerticalKey, TKeyRow newVerticalKey)
Parameters
Type |
Name |
Description |
TKeyRow |
oldVerticalKey |
|
TKeyRow |
newVerticalKey |
|
Clear()
Clear the entire content of the matrix.
Declaration
ClearColumns()
Clear all columns from the matrix.
Declaration
public void ClearColumns()
ClearRows()
Clear all rows from the matrix.
Declaration
Compact()
Remove empty columns or rows.
Declaration
Contains(TKeyColumn, TKeyRow)
Get if the item at the given position has a value.
Declaration
public bool Contains(TKeyColumn horizontalKey, TKeyRow verticalKey)
Parameters
Type |
Name |
Description |
TKeyColumn |
horizontalKey |
Horizontal key
|
TKeyRow |
verticalKey |
Vertical key
|
Returns
Type |
Description |
bool |
True item at the given position has a value.
|
ContainsColumn(TKeyColumn)
Get if this is an exsisting key in the matrix.
Declaration
public bool ContainsColumn(TKeyColumn horizontalKey)
Parameters
Type |
Name |
Description |
TKeyColumn |
horizontalKey |
Horizontal key
|
Returns
Type |
Description |
bool |
True if this is an exsisting key in the matrix.
|
ContainsRow(TKeyRow)
Get if this is an exsisting key in the matrix.
Declaration
public bool ContainsRow(TKeyRow verticalKey)
Parameters
Type |
Name |
Description |
TKeyRow |
verticalKey |
Vertical key.
|
Returns
Type |
Description |
bool |
True if this is an exsisting key in the matrix.
|
Exists(IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>>, Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>>)
Declaration
public bool Exists(IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>> items, Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>> condition)
Parameters
Returns
GetColumn(TKeyColumn)
Declaration
public IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>> GetColumn(TKeyColumn horizontalKey)
Parameters
Type |
Name |
Description |
TKeyColumn |
horizontalKey |
|
Returns
GetColumnIndex(TKeyColumn)
Declaration
public int GetColumnIndex(TKeyColumn horizontakKey)
Parameters
Type |
Name |
Description |
TKeyColumn |
horizontakKey |
|
Returns
GetColumnKey(int)
Declaration
public TKeyColumn GetColumnKey(int index)
Parameters
Type |
Name |
Description |
int |
index |
|
Returns
Type |
Description |
TKeyColumn |
|
GetColumnKeys()
Get an array containing all the horizontal keys.
Declaration
public TKeyColumn[] GetColumnKeys()
Returns
Type |
Description |
TKeyColumn[] |
Array containing all the horizontal keys.
|
GetEnumerator()
Declaration
public IEnumerator<MatrixItem<TKeyColumn, TKeyRow, TItem>> GetEnumerator()
Returns
GetRow(TKeyRow)
Declaration
public IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>> GetRow(TKeyRow verticalKey)
Parameters
Type |
Name |
Description |
TKeyRow |
verticalKey |
|
Returns
GetRowIndex(TKeyRow)
Declaration
public int GetRowIndex(TKeyRow verticalKey)
Parameters
Type |
Name |
Description |
TKeyRow |
verticalKey |
|
Returns
GetRowKey(int)
Declaration
public TKeyRow GetRowKey(int index)
Parameters
Type |
Name |
Description |
int |
index |
|
Returns
GetRowKeys()
Get an array containing all the vertical keys.
Declaration
public TKeyRow[] GetRowKeys()
Returns
Type |
Description |
TKeyRow[] |
Array containing all the vertical keys.
|
MoveItems(KeyedMatrix<TKeyColumn, TKeyRow, TItem>, IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>>, Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>>)
Movie items this instance of the KeyedMatrix to another instance.
Declaration
public void MoveItems(KeyedMatrix<TKeyColumn, TKeyRow, TItem> destination, IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>> items, Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>> condition)
Parameters
Type |
Name |
Description |
KeyedMatrix<TKeyColumn, TKeyRow, TItem> |
destination |
Destination matrix to move items to.
|
IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>> |
items |
Items to be moved.
|
Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>> |
condition |
Condition for the item to be moved. Only items with positive conditions are moved.
|
MoveItems(KeyedMatrix<TKeyColumn, TKeyRow, TItem>, IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>>, Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>>, Action<MatrixItem<TKeyColumn, TKeyRow, TItem>>)
Movie items this instance of the KeyedMatrix to another instance.
Declaration
public void MoveItems(KeyedMatrix<TKeyColumn, TKeyRow, TItem> destination, IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>> items, Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>> condition, Action<MatrixItem<TKeyColumn, TKeyRow, TItem>> actionIfMoved)
Parameters
Type |
Name |
Description |
KeyedMatrix<TKeyColumn, TKeyRow, TItem> |
destination |
Destination matrix to move items to.
|
IEnumerable<MatrixItem<TKeyColumn, TKeyRow, TItem>> |
items |
Items to be moved.
|
Predicate<MatrixItem<TKeyColumn, TKeyRow, TItem>> |
condition |
Condition for the item to be moved. Only items with positive conditions are moved.
|
Action<MatrixItem<TKeyColumn, TKeyRow, TItem>> |
actionIfMoved |
Action performed on the item if it is moved.
|
RemoveColumn(TKeyColumn)
Declaration
public void RemoveColumn(TKeyColumn columnlKey)
Parameters
Type |
Name |
Description |
TKeyColumn |
columnlKey |
|
RemoveRow(TKeyRow)
Declaration
public void RemoveRow(TKeyRow verticalKey)
Parameters
Type |
Name |
Description |
TKeyRow |
verticalKey |
|
ToArray()
Declaration
public MatrixItem<TKeyColumn, TKeyRow, TItem>[,] ToArray()
Returns
Type |
Description |
MatrixItem<TKeyColumn, TKeyRow, TItem>[,] |
|
Implements
Extension Methods