| Package | de.polygonal.ds |
| Class | public class Array3 |
| Inheritance | Array3 Object |
| Implements | Collection |
| Property | Defined By | ||
|---|---|---|---|
| depth : int
Indicates the depth (layers). | Array3 | ||
| height : int
Indicates the height (rows). | Array3 | ||
| size : int [read-only]
The total number of items. | Array3 | ||
| width : int
Indicates the width (columns). | Array3 | ||
| Method | Defined By | ||
|---|---|---|---|
Array3(w:int, h:int, d:int)
Initializes a three-dimensional array to match the given width,
height and depth. | Array3 | ||
clear():void
Clears all items. | Array3 | ||
contains(obj:*):Boolean
Determines if the collection contains a given item. | Array3 | ||
dump(z:int):String
Prints out all elements (for debug/demo purposes). | Array3 | ||
fill(obj:*):void
Writes a given value into each cell of the three-dimensional array. | Array3 | ||
get(x:int, y:int, z:int):*
Reads a value from a given x/y/z index. | Array3 | ||
getCol(z:int, x:int):Array
Extracts a colum from a given index and depth (layer). | Array3 | ||
Initializes an iterator object pointing to the first item in the
collection. | Array3 | ||
Copies the data from a given depth (layer) into a
two-dimensional array. | Array3 | ||
getPile(x:int, y:int):Array
Extracts a pile going through the given x,y index. | Array3 | ||
getRow(z:int, y:int):Array
Extracts a row from a given y index and depth (layer). | Array3 | ||
isEmpty():Boolean
Checks if the collection is empty. | Array3 | ||
resize(w:int, h:int, d:int):void
Resizes the array to match the given width, height and depth. | Array3 | ||
set(x:int, y:int, z:int, obj:*):void
Writes a value into a cell at the given x/y/z index. | Array3 | ||
setCol(z:int, x:int, a:Array):void
Inserts new values into a complete column at a given depth into the
three-dimensional array. | Array3 | ||
setPile(x:int, y:int, a:Array):void
Inserts new values into a complete pile of the three-dimensional
array going through the given x, y index. | Array3 | ||
setRow(z:int, y:int, a:Array):void
Inserts new values into a complete row at a given depth into the
three-dimensional array. | Array3 | ||
toArray():Array
Converts the collection into an array. | Array3 | ||
toString():String
Prints out a string representing the current object. | Array3 | ||
| depth | property |
depth:intIndicates the depth (layers). If a new depth is set, the three-dimensional array is resized accordingly.
public function get depth():int public function set depth(value:int):void| height | property |
height:intIndicates the height (rows). If a new height is set, the three-dimensional array is resized accordingly.
public function get height():int public function set height(value:int):void| size | property |
size:int [read-only] The total number of items.
public function get size():int| width | property |
width:intIndicates the width (columns). If a new width is set, the three-dimensional array is resized accordingly.
public function get width():int public function set width(value:int):void| Array3 | () | Constructor |
public function Array3(w:int, h:int, d:int)Initializes a three-dimensional array to match the given width, height and depth. The smallest possible size is a 1x1x1 matrix. The initial value of all items is null.
Parametersw:int — The width (equals number of columns).
| |
h:int — The height (equals number of rows).
| |
d:int — The depth (equals number of layers).
|
| clear | () | method |
public function clear():voidClears all items.
| contains | () | method |
public function contains(obj:*):BooleanDetermines if the collection contains a given item.
Parameters
obj:* — The item to search for.
|
Boolean — True if the item exists, otherwise false.
|
| dump | () | method |
public function dump(z:int):StringPrints out all elements (for debug/demo purposes).
Parameters
z:int — The layer to dump.
|
String — A human-readable representation of the structure.
|
| fill | () | method |
public function fill(obj:*):voidWrites a given value into each cell of the three-dimensional array.
Parameters
obj:* — The item to be written into each cell.
|
| get | () | method |
public function get(x:int, y:int, z:int):*Reads a value from a given x/y/z index. No boundary check is done, so you have to make sure that the input coordinates do not exceed the width, height or depth of the three-dimensional array.
Parameters
x:int — The x index (column).
| |
y:int — The y index (row).
| |
z:int — The z index (layer).
|
* — The value at the given x/y/z index.
|
| getCol | () | method |
public function getCol(z:int, x:int):ArrayExtracts a colum from a given index and depth (layer).
Parameters
z:int — The layer containing the column.
| |
x:int — The column index.
|
Array — An array storing the values of the column.
|
| getIterator | () | method |
public function getIterator():IteratorInitializes an iterator object pointing to the first item in the collection.
ReturnsIterator — An iterator object.
|
| getLayer | () | method |
public function getLayer(z:int):Array2Copies the data from a given depth (layer) into a two-dimensional array.
Parameters
z:int — The layer to extract.
|
Array2 — The layer's data.
|
| getPile | () | method |
public function getPile(x:int, y:int):ArrayExtracts a pile going through the given x,y index. The order is from bottom to top (lowest to highest layer).
Parameters
x:int — The column index.
| |
y:int — The row index.
|
Array — An array storing the values of the pile.
|
| getRow | () | method |
public function getRow(z:int, y:int):ArrayExtracts a row from a given y index and depth (layer).
Parameters
z:int — The layer containing the row
| |
y:int — The row index.
|
Array — An array storing the values of the row.
|
| isEmpty | () | method |
public function isEmpty():BooleanChecks if the collection is empty.
ReturnsBoolean — True if empty, otherwise false.
|
| resize | () | method |
public function resize(w:int, h:int, d:int):voidResizes the array to match the given width, height and depth. If the new size is smaller than the existing size, values are lost because of truncation, otherwise all values are preserved.
Parameters
w:int — The new width (cols).
| |
h:int — The new height (rows).
| |
d:int — The new depth (layers).
|
| set | () | method |
public function set(x:int, y:int, z:int, obj:*):voidWrites a value into a cell at the given x/y/z index. No boundary check is done, so you have to make sure that the input coordinates do not exceed the width, height or depth of the two-dimensional array.
Parameters
x:int — The x index (column).
| |
y:int — The y index (row).
| |
z:int — The z index (layer).
| |
obj:* — The item to be written into the cell.
|
| setCol | () | method |
public function setCol(z:int, x:int, a:Array):voidInserts new values into a complete column at a given depth into the three-dimensional array. The new column is truncated if it exceeds the existing height.
Parameters
z:int — The layer containing the existing column.
| |
x:int — The column index.
| |
a:Array — The column's new values.
|
| setPile | () | method |
public function setPile(x:int, y:int, a:Array):voidInserts new values into a complete pile of the three-dimensional array going through the given x, y index. The pile is truncated if it exceeds the existing depth.
Parameters
x:int — The column index.
| |
y:int — The row index.
| |
a:Array — The pile's new values.
|
| setRow | () | method |
public function setRow(z:int, y:int, a:Array):voidInserts new values into a complete row at a given depth into the three-dimensional array. The new row is truncated if it exceeds the existing width.
Parameters
z:int — The layer containing the existing row.
| |
y:int — The row index.
| |
a:Array — The row's new values.
|
| toArray | () | method |
public function toArray():ArrayConverts the collection into an array.
ReturnsArray — An array.
|
| toString | () | method |
public function toString():StringPrints out a string representing the current object.
ReturnsString — A string representing the current object.
|