Array2 |
A two-dimensonal array.
Array2 | A two-dimensonal array. |
Functions | |
Array2 | Initializes a two-dimensional array to match a given width and height. |
Properties | |
width | Indicates the width (colums). |
width | @private |
height | Indicates the height (rows). |
height | @private |
Functions | |
fill | Writes a given value into each cell of the two-dimensional array. |
get | Reads a value from a given x/y index. |
set | Writes a value into a cell at the given x/y index. |
resize | Resizes the array to match the given width and height. |
getRow | Extracts a row from a given index. |
setRow | Inserts new values into a complete row of the two-dimensional array. |
getCol | Extracts a column from a given index. |
setCol | Inserts new values into a complete column of the two-dimensional array. |
shiftLeft | Shifts all columns by one column to the left. |
shiftRight | Shifts all columns by one column to the right. |
shiftUp | Shifts all rows up by one row. |
shiftDown | Shifts all rows down by one row. |
appendRow | Appends a new row. |
prependRow | Prepends a new row. |
appendCol | Appends a new column. |
prependCol | Prepends a new column. |
transpose | Flips rows with cols and vice versa. |
getArray | Grants access to the the linear array which is used internally to store the data in the two-dimensional array. |
contains | @inheritDoc |
clear | @inheritDoc |
getIterator | @inheritDoc |
Properties | |
size | @inheritDoc |
Functions | |
isEmpty | @inheritDoc |
toArray | @inheritDoc |
toString | Prints out a string representing the current object. |
dump | Prints out all elements (for debug/demo purposes). |
public function get( x: int, y: int ):*
Reads a value from a given x/y index. No boundary check is done, so you have to make sure that the input coordinates do not exceed the width or height of the two-dimensional array.
x | The x index (column). |
y | The y index (row). |
The value at the given x/y index.
public function set( x: int, y: int, obj: * ):void
Writes a value into a cell at the given x/y index. Because of performance reasons no boundary check is done, so you have to make sure that the input coordinates do not exceed the width or height of the two-dimensional array.
x | The x index (column). |
y | The y index (row). |
obj | The item to be written into the cell. |
public function resize( w: int, h: int ):void
Resizes the array to match the given width and height. If the new size is smaller than the existing size, values are lost because of truncation, otherwise all values are preserved. The minimum size is 2x2 matrix.
w | The new width (cols). |
h | The new height (rows). |
Initializes a two-dimensional array to match a given width and height.
public function Array2( width: int, height: int )
Indicates the width (colums).
public function get width():int
Indicates the height (rows).
public function get height():int
Writes a given value into each cell of the two-dimensional array.
public function fill( obj: * ):void
Reads a value from a given x/y index.
public function get( x: int, y: int ):*
Writes a value into a cell at the given x/y index.
public function set( x: int, y: int, obj: * ):void
Resizes the array to match the given width and height.
public function resize( w: int, h: int ):void
Extracts a row from a given index.
public function getRow( y: int ):Array
Inserts new values into a complete row of the two-dimensional array.
public function setRow( y: uint, a: Array ):void
Extracts a column from a given index.
public function getCol( x: int ):Array
Inserts new values into a complete column of the two-dimensional array.
public function setCol( x: int, a: Array ):void
Shifts all columns by one column to the left.
public function shiftLeft():void
Shifts all columns by one column to the right.
public function shiftRight():void
Shifts all rows up by one row.
public function shiftUp():void
Shifts all rows down by one row.
public function shiftDown():void
Appends a new row.
public function appendRow( a: Array ):void
Prepends a new row.
public function prependRow( a: Array ):void
Appends a new column.
public function appendCol( a: Array ):void
Prepends a new column.
public function prependCol( a: Array ):void
Flips rows with cols and vice versa.
public function transpose():void
Grants access to the the linear array which is used internally to store the data in the two-dimensional array.
public function getArray():Array
@inheritDoc
public function contains( obj: * ):Boolean
@inheritDoc
public function clear():void
@inheritDoc
public function getIterator():Iterator
@inheritDoc
public function get size():int
@inheritDoc
public function isEmpty():Boolean
@inheritDoc
public function toArray():Array
Prints out a string representing the current object.
public function toString():String
Prints out all elements (for debug/demo purposes).
public function dump():String