Class Space<C>
Represents an n-dimensional array that stores containers (Container objects) at specific locations represented by points (Point objects).
Inherited Members
Namespace: MultidimLib
Syntax
public class Space<C> : Space where C : Container
Type Parameters
| Name | Description |
|---|---|
| C | The containers' type that the space will store. |
Constructors
Space(Dimension[])
Calls the Space(IEnumerable<Dimension>) constructor.
Declaration
public Space(params Dimension[] dimensions)
Parameters
| Type | Name | Description |
|---|---|---|
| Dimension[] | dimensions | The dimensions to be passed onto the Space(IEnumerable<Dimension>) constructor. |
Space(IEnumerable<Dimension>)
Initializes a new space (Space<C>) with the provided dimensions.
Declaration
public Space(IEnumerable<Dimension> dimensions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<Dimension> | dimensions | The collection of dimensions that will shape the space. |
Exceptions
| Type | Condition |
|---|---|
| DimensionException | Thrown when no dimension has been provided or any of the provided ones is already associated to a previously initialized space. |
Properties
Item[Point]
Gets or sets the container stored at the location indicated by the specified point.
Declaration
public C this[Point point] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The point whereat the container is or will be stored. |
Property Value
| Type | Description |
|---|---|
| C | The container at the specified point. |
Exceptions
| Type | Condition |
|---|---|
| PointException | Thrown when the specified point does not fit inside the current space. |
Item[Int32, Int32[]]
Calls the Item[Point] property.
Declaration
public C this[int coordinate, params int[] coordinates] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | coordinate | The first point coordinate to be passed onto the Item[Point] property. |
| System.Int32[] | coordinates | Any following point coordinates to be passed onto the Item[Point] property. |
Property Value
| Type | Description |
|---|---|
| C | The container at the specified coordinates. |
Methods
Clear()
Removes from the current space every container stored in it.
Declaration
public void Clear()
ClearAsync()
Returns a task that asynchronously calls the Clear() method.
Declaration
public Task ClearAsync()
IsEmptyAt(Point)
Determines whether no container is stored at the specified location in the current space. Returns true if so, false otherwise.
Declaration
public bool IsEmptyAt(Point point)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | point | The location wherein to determine storage of containers. |
Exceptions
| Type | Condition |
|---|---|
| PointException | Thrown when the provided point does not fit inside the current space. |