Array2D:
Filter:
Classes | Collections > Ordered

Array2D : Collection : Object

two-dimensional array
Source: Array2D.sc

Description

Represents a two-dimensional array of data. The number of rows and columns is fixed.

NOTE: It is possible to implement a similar behaviour using an "array-of-arrays" - see the examples towards the bottom of this page for comparison.

Class Methods

Array2D.new(rows: 1, cols: 1)

Create an array of the specified size.

Array2D.fromArray(rows, cols, array)

Build an Array2D from the supplied array.

Inherited class methods

Instance Methods

.at(row, col)

Get a value from the array.

.put(row, col, val)

Put a value into the array.

.colsDo(func)

Iterate over the columns. Each column will be passed to func in turn.

.rowsDo(func)

Iterate over the rows. Each row will be passed to func in turn.

.colAt(ci)

Retrieve a single column.

.rowAt(ri)

Retrieve a single row.

.asArray

Return a flat array containing the elements.

Returns:

Inherited instance methods

Undocumented instance methods

.array

.cols

.do(func)

.rows

.with(aarray)

Examples