Buffer class abstract
Stores a 2D buffer of cells.
A buffer maintains a two-dimensional representation of Cell instances, and
provides methods for querying them programatically, such as get or the
bracket operator ([index]
).
Virtual buffers are also suitable for testing, as well as maintaining a platform independent stateful view that will later be synchronized to a platform-specific view.
It is considered invalid to extend, implement, or mix-in this class.
- Implementers
- Annotations
-
- @sealed
Constructors
- Buffer(int width, int height, {Cell initialCell})
-
Creates a new buffer of the specified
width
andheight
.factory -
Buffer.fromCells(Iterable<
Cell> cells, {required int width}) -
Creates a new buffer by copying a predefined collections of
cells
.factory -
Buffer.fromMatrix(List<
List< cells)Cell> > -
Creates a new buffer by copying a nested list (2D matrix) of
cells
.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → int
-
Height of the buffer.
no setter
- length → int
-
Total number of cells in the buffer.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- width → int
-
Width of the buffer.
no setter
Methods
-
get(
int x, int y) → Cell -
Returns the cell located at (
x
,y
). -
inBounds(
int x, int y) → bool -
Returns whetyher
x
andy
are considered within bounds of the buffer. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDebugString(
) → String - Returns a plain-text preview of the underlying buffer.
-
toList(
) → List< Cell> - Returns the buffer as a list of cells.
-
toMatrix(
) → List< List< Cell> > - Returns the buffer as a nested list (2D matrix) of cells.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → Cell -
Returns the cell located at the specified
index
.