Class DimensionCollection
Represents an enumerable read-only positive-infinite collection of dimensions (Dimension objects) that shape a specific underlaying space (Space object).
Inheritance
Namespace: MultidimLib
Syntax
public sealed class DimensionCollection : IEnumerable<Dimension>, IEnumerable
Properties
Count
Gets the number of representative dimensions in the current collection, which are the first one and each next dimension found until the last one different from Default.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The number of representative dimensions. |
Item[Int32]
Gets the corresponding dimension at the specified index. If the index is greater than the number of representative dimensions, it returns Default.
Declaration
public Dimension this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The 0-based index of the dimension. |
Property Value
| Type | Description |
|---|---|
| Dimension | The dimension at the specified index. |
Exceptions
| Type | Condition |
|---|---|
| DimensionException | Thrown when the provided index is lower than 0. |
Methods
Clone()
Makes a copy of each individual dimension in the current collection and yields them.
Declaration
public IEnumerable<Dimension> Clone()
Equals(DimensionCollection)
Determines whether a provided dimension collection is equal to the current dimension collection by checking the lower and upper coordinates of each collections' dimensions (value equality).
Declaration
public bool Equals(DimensionCollection dimensionCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| DimensionCollection | dimensionCollection | The dimension collection against which to compare equality. |
Equals(ICollection<Dimension>)
Calls the Equals(DimensionCollection) method.
Declaration
public bool Equals(ICollection<Dimension> dimensionCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.ICollection<Dimension> | dimensionCollection | The dimension collection to be passed onto the Equals(DimensionCollection) method. |
Equals(Object)
Determines whether a provided object is the current dimension collection (reference equality).
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object against which to compare equality. |
Overrides
GetIndex(Dimension)
Returns the 0-based index of the provided dimension in the current collection.
Declaration
public int GetIndex(Dimension dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| Dimension | dimension | The dimension to find its index. |
Exceptions
| Type | Condition |
|---|---|
| DimensionException | Thrown when the provided dimension is not associated to the current collection. |
HoldsDimension(Dimension)
Determines whether the provided dimension is associated to the current collection and thus to the underlaying space.
Declaration
public bool HoldsDimension(Dimension dimension)
Parameters
| Type | Name | Description |
|---|---|---|
| Dimension | dimension | The dimension to test. |
ToString()
Returns a string representation of the current dimension collection formated as:
"[d_0.LowerCoordinate, d_0.UpperCoordinate]|d_0.Length, [d_1.LowerCoordinate, d_1.UpperCoordinate]|d_1.Length, ...,
[d_n.LowerCoordinate, d_n.UpperCoordinate]|d_n.Length"
where d_0 is the first representative dimension, d_1 the second one, and d_n the n-th one.
Declaration
public override string ToString()
Overrides
TryGetIndex(Dimension, ref Int32)
Attempts to retrieve the 0-based index of the provided dimension in the current collection, and assigns it
to the index argument. Returns true if it succeeds, false otherwise.
Declaration
public bool TryGetIndex(Dimension dimension, ref int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Dimension | dimension | The dimension to find its index. |
| System.Int32 | index | The variable wherein to assign the retrieved 0-based index. |
Explicit Interface Implementations
IEnumerable<Dimension>.GetEnumerator()
Returns an enumerator that iterates over the representative dimensions in the current collection.
Declaration
public IEnumerator<Dimension> IEnumerable<Dimension>.GetEnumerator()