Class SettableGridView1DIndexBase<T>
Exactly like SettableGridViewBase<T>, except for the one indexer left to the user to implement is the one which takes a 1D array, and the position-based indexers are implemented off that.
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public abstract class SettableGridView1DIndexBase<T> : Object, ISettableGridView<T>, IGridView<T>
Type Parameters
Name | Description |
---|---|
T | The type of value being stored. |
Remarks
This can be more convenient than SettableGridViewBase<T> for use cases where 1D indices are easiest to work with, and is technically more efficient for cases such as wrapping a 1D array, where the backing data structure takes an index (although this should typically be considered a micro-optimization).
Constructors
SettableGridView1DIndexBase()
Declaration
protected SettableGridView1DIndexBase()
Properties
Count
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Height
The height of the grid being represented.
Declaration
public abstract int Height { get; }
Property Value
Type | Description |
---|---|
Int32 |
Item[Point]
Interface designed to act as a standardized input/output format that defines minimal required data for algorithms that operate and make changes to a grid of some sort. For a concrete implementation to subclass for custom implementations, see SettableGridViewBase<T>.
Declaration
public T this[Point pos] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Point | pos | Location to get/set the value for. |
Property Value
Type | Description |
---|---|
T | The "value" associated with the provided location. |
Remarks
See IGridView<T>. This interface serves the same purpose, but for cases when it is also necessary for an algorithm to be able to change the value at each location.
Like IGridView, a number of implementations of this interface to cover common needs are provided. For example, ArrayView<T> defines the interface such that the data is retrieved from and set to an array, and LambdaSettableGridView<T> defines the interface such that arbitrary callbacks are used to retrieve and set the data.
Item[Int32]
Interface designed to act as a standardized input/output format that defines minimal required data for algorithms that operate and make changes to a grid of some sort. For a concrete implementation to subclass for custom implementations, see SettableGridViewBase<T>.
Declaration
public abstract T this[int index1D] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index1D | 1D index of location to get/set the "value" for. |
Property Value
Type | Description |
---|---|
T | The "value" associated with the given location. |
Remarks
See IGridView<T>. This interface serves the same purpose, but for cases when it is also necessary for an algorithm to be able to change the value at each location.
Like IGridView, a number of implementations of this interface to cover common needs are provided. For example, ArrayView<T> defines the interface such that the data is retrieved from and set to an array, and LambdaSettableGridView<T> defines the interface such that arbitrary callbacks are used to retrieve and set the data.
Item[Int32, Int32]
Interface designed to act as a standardized input/output format that defines minimal required data for algorithms that operate and make changes to a grid of some sort. For a concrete implementation to subclass for custom implementations, see SettableGridViewBase<T>.
Declaration
public T this[int x, int y] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | x | X-value of location. |
Int32 | y | Y-value of location. |
Property Value
Type | Description |
---|---|
T | The "value" associated with that location. |
Remarks
See IGridView<T>. This interface serves the same purpose, but for cases when it is also necessary for an algorithm to be able to change the value at each location.
Like IGridView, a number of implementations of this interface to cover common needs are provided. For example, ArrayView<T> defines the interface such that the data is retrieved from and set to an array, and LambdaSettableGridView<T> defines the interface such that arbitrary callbacks are used to retrieve and set the data.
Width
The width of the grid being represented.
Declaration
public abstract int Width { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Clear()
Sets every location within the grid view to the default value for the type.
Declaration
public virtual void Clear()
Remarks
This function can sometimes be implemented more efficiently than Fill(default), so it is provided as an interface function to enable dispatching.
Remember the default value of a non-nullable type is null for reference types; so use with caution if your element type is non-nullable!
Fill(T)
Sets every location within the grid view to the given value.
Declaration
public virtual void Fill(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | Value to set to all locations in the grid view. |