Class SettableGridViewBase<T>
A convenient base class to inherit from when implementing ISettableGridView<T> that minimizes the number of items you must implement by implementing indexers in terms of a single indexer taking a Point.
Inheritance
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public abstract class SettableGridViewBase<T> : Object, ISettableGridView<T>, IGridView<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
SettableGridViewBase()
Declaration
protected SettableGridViewBase()
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 abstract 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 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. |