Show / Hide Table of Contents

Class Space

Base class for an n-dimensional array.

Inheritance
System.Object
Space
Space<C>
Namespace: MultidimLib
Syntax
public class Space

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) 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

Dimensions

Gets or sets the collection of dimensions that shape the current space.

Declaration
public DimensionCollection Dimensions { get; }
Property Value
Type Description
DimensionCollection

The dimensions that shape the current space.

Size

Gets the size of the current space.

Declaration
public int Size { get; }
Property Value
Type Description
System.Int32

The size of the current space, which is the result of multiplying the lengths of the dimensions shaping the space.

Methods

FirstPoint()

Returns the first point of the current space, which is composed out of the lower coordinate of each space's dimension.

Declaration
public Point FirstPoint()

FromR1Point(Point)

Linearly maps a provided point, that fits inside a space formed of a single dimension whose lower coordinate is equal to 0 and its upper coordinate is equal to the current space's size minus 1, into the corresponding point which fits inside the current space.

Declaration
public Point FromR1Point(Point r1Point)
Parameters
Type Name Description
Point r1Point

The point to be mapped.

Exceptions
Type Condition
PointException

Thrown when the provided point does not fit inside the single-dimension space.

FromR1Point(Int32)

Calls the FromR1Point(Point) method.

Declaration
public Point FromR1Point(int coordinate)
Parameters
Type Name Description
System.Int32 coordinate

The coordinate to be passed onto the FromR1Point(Point) method.

FromRnPoint(Point, Space)

Linearly maps a provided point, that fits inside a provided source space, into the corresponding point which fits inside the current space.

Declaration
public Point FromRnPoint(Point rnPoint, Space sourceSpace)
Parameters
Type Name Description
Point rnPoint

The point to be mapped.

Space sourceSpace

The source space.

Exceptions
Type Condition
SpaceException

Thrown when the size of the current space is lower than the size of the source space.

PointException

Thrown when the provided point does not fit inside the source space.

HoldsPoint(Point)

Determines whether a provided point fits inside the current space. Returns true if so, false otherwise.

Declaration
public bool HoldsPoint(Point point)
Parameters
Type Name Description
Point point

The point to test.

LastPoint()

Returns the last point of the current space, which is composed out of the upper coordinate of each space's dimension.

Declaration
public Point LastPoint()

Points()

Returns an enumerator that iterates over all possible points that the current space holds, sorted according to the original dimension order.

Declaration
public IEnumerable<Point> Points()

Points(IEnumerable<Int32>)

Returns an enumerator that iterates over all possible points that the current space holds, sorted according to a specified dimension order.

Declaration
public IEnumerable<Point> Points(IEnumerable<int> dimensionIndexes)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Int32> dimensionIndexes

The order of the dimensions specified by their 0-based indexes.

Exceptions
Type Condition
DimensionException

Thrown when any dimension index has been specified more than once, or when not all of them have been specified, or when any of the specified ones is lower than 0.

Points(Int32[])

Calls the Points(IEnumerable<Int32>) method.

Declaration
public IEnumerable<Point> Points(params int[] dimensionIndexes)
Parameters
Type Name Description
System.Int32[] dimensionIndexes

The order of the dimensions to be passed onto the Points(IEnumerable<Int32>) method.

ToR1Point(Point)

Linearly maps a provided point which fits inside the current space into the corresponding point that fits inside a space formed of a single dimension whose lower coordinate is equal to 0 and its upper coordinate is equal to the current space's size minus 1.

Declaration
public Point ToR1Point(Point rnPoint)
Parameters
Type Name Description
Point rnPoint

The point to be mapped.

Exceptions
Type Condition
PointException

Thrown when the provided point does not fit inside the current space.

ToR1Point(Int32[])

Calls the ToR1Point(Point) method.

Declaration
public Point ToR1Point(params int[] coordinates)
Parameters
Type Name Description
System.Int32[] coordinates

The coordinates to be passed onto the ToR1Point(Point) method.

ToRnPoint(Point, Space)

Linearly maps a provided point which fits inside the current space into the corresponding point that fits inside the provided arrival space.

Declaration
public Point ToRnPoint(Point rnPoint, Space arrivalSpace)
Parameters
Type Name Description
Point rnPoint

The point to be mapped.

Space arrivalSpace

The arrival space.

Exceptions
Type Condition
SpaceException

Thrown when the size of the arrival space is lower than the size of the current space.

PointException

Thrown when the provided point does not fit inside the current space.

ToString()

Returns a string representation of the current space 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 space's representative dimension, d_1 the second one, and d_n the n-th one.

Declaration
public override string ToString()
Overrides
System.Object.ToString()

Extension Methods

Initialization.C<T>(T)
Back to top MultidimLib from Ecuador.