Grid class

The Grid class, which serves as the encapsulation of the layout of the nodes. @constructor @param {number} width Number of columns of the grid. @param {number} height Number of rows of the grid. @param {Array.<Array.<(number|boolean)>>} matrix - A 0-1 matrix representing the walkable status of the nodes(0 or false for walkable). If the matrix is not supplied, all the nodes will be walkable.

Constructors

Grid(dynamic width, dynamic height, [dynamic matrix])

Properties

hashCode int
The hash code for this object.
no setterinherited
height int
getter/setter pair
nodes ↔ dynamic
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
getter/setter pair

Methods

clone() → dynamic
Get a clone of this grid. @return {Grid} Cloned grid.
getNeighbors(dynamic node, dynamic allowDiagonal, [dynamic dontCrossCorners = false]) → dynamic
Get the neighbors of the given node.
getNodeAt(dynamic x, dynamic y) Node
isInside(dynamic x, dynamic y) bool
Determine whether the position is inside the grid. XXX: grid.isInside(x, y) is wierd to read. It should be (x, y) is inside grid, but I failed to find a better name for this method. @param {number} x @param {number} y @return {boolean}
isWalkableAt(dynamic x, dynamic y) bool
Determine whether the node at the given position is walkable. (Also returns false if the position is outside the grid.) @param {number} x - The x coordinate of the node. @param {number} y - The y coordinate of the node. @return {boolean} - The walkability of the node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setWalkableAt(dynamic x, dynamic y, dynamic walkable) → dynamic
Set whether the node on the given position is walkable. NOTE: throws exception if the coordinate is not inside the grid. @param {number} x - The x coordinate of the node. @param {number} y - The y coordinate of the node. @param {boolean} walkable - Whether the position is walkable.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited