Array3

A three-dimensonal array.

Summary
Array3A three-dimensonal array.
Functions
Array3Initializes a three-dimensional array to match the given width, height and depth.
Properties
widthIndicates the width (columns).
width@private
heightIndicates the height (rows).
height@private
depthIndicates the depth (layers).
depth@private
Functions
fillWrites a given value into each cell of the three-dimensional array.
getReads a value from a given x/y/z index.
setWrites a value into a cell at the given x/y/z index.
resizeResizes the array to match the given width, height and depth.
getLayerCopies the data from a given depth (layer) into a two-dimensional array.
getRowExtracts a row from a given y index and depth (layer).
getColExtracts a colum from a given index and depth (layer).
contains@inheritDoc
clear@inheritDoc
getIterator@inheritDoc
Properties
size@inheritDoc
Functions
isEmpty@inheritDoc
toArray@inheritDoc
toStringPrints out a string representing the current object.
dumpPrints out all elements (for debug/demo purposes).

Functions

Array3

public function Array3(w: int,
h: int,
d: int)

Initializes a three-dimensional array to match the given width, height and depth.  The initial value of all items is null.

Parameters

wThe width (equals number of columns).
hThe height (equals number of rows).
dThe depth (equals number of layers). 

Properties

width

public function get width():int

Indicates the width (columns).  If a new width is set, the three-dimensional array is resized accordingly.

width

public function set width(w: int):void

@private

height

public function get height():int

Indicates the height (rows).  If a new height is set, the three-dimensional array is resized accordingly.

height

public function set height(h: int):void

@private

depth

public function get depth():int

Indicates the depth (layers).  If a new depth is set, the three-dimensional array is resized accordingly.

depth

public function set depth(d: int):void

@private

Functions

fill

public function fill(obj: *):void

Writes a given value into each cell of the three-dimensional array.

Parameters

itemThe item to be written into each cell. 

get

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

xThe x index (column).
yThe y index (row). * @param z The z index (layer). 

Returns

The value at the given x/y/z index. 

set

public function set(x: int,
y: int,
z: int,
obj: *):void

Writes 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

xThe x index (column).
yThe y index (row).
zThe z index (layer).
objThe item to be written into the cell. 

resize

public function resize(w: int,
h: int,
d: int):void

Resizes 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

wThe new width (cols).
hThe new height (rows). * @param d The new depth (layers). 

getLayer

public function getLayer(z: int):Array2

Copies the data from a given depth (layer) into a two-dimensional array.

Parameters

zThe layer to extract. 

Returns

The layer’s data. 

getRow

public function getRow(z: int,
y: int):Array

Extracts a row from a given y index and depth (layer).

Parameters

zThe layer containing the row
yThe row index. 

Returns

An array storing the values of the row. 

getCol

public function getCol(z: int,
x: int):Array

Extracts a colum from a given index and depth (layer).

Parameters

zThe layer containing the column.
xThe column index. 

Returns

An array storing the values of the column. 

contains

public function contains(obj: *):Boolean

@inheritDoc

clear

public function clear():void

@inheritDoc

getIterator

public function getIterator():Iterator

@inheritDoc

Properties

size

public function get size():int

@inheritDoc

Functions

isEmpty

public function isEmpty():Boolean

@inheritDoc

toArray

public function toArray():Array

@inheritDoc

toString

public function toString():String

Prints out a string representing the current object.

Returns

A string representing the current object. 

dump

public function dump():String

Prints out all elements (for debug/demo purposes).

Returns

A human-readable representation of the structure. 

A ‘java-style’ collection interface.
public function Array3(w: int,
h: int,
d: int)
Initializes a three-dimensional array to match the given width, height and depth.
public function get width():int
Indicates the width (columns).
public function get height():int
Indicates the height (rows).
public function get depth():int
Indicates the depth (layers).
public function fill(obj: *):void
Writes a given value into each cell of the three-dimensional array.
public function get(x: int,
y: int,
z: int):*
Reads a value from a given x/y/z index.
public function set(x: int,
y: int,
z: int,
obj: *):void
Writes a value into a cell at the given x/y/z index.
public function resize(w: int,
h: int,
d: int):void
Resizes the array to match the given width, height and depth.
public function getLayer(z: int):Array2
Copies the data from a given depth (layer) into a two-dimensional array.
public function getRow(z: int,
y: int):Array
Extracts a row from a given y index and depth (layer).
public function getCol(z: int,
x: int):Array
Extracts a colum from a given index and depth (layer).
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
@inheritDoc
public function toString():String
Prints out a string representing the current object.
public function dump():String
Prints out all elements (for debug/demo purposes).
Close