Immutable 2D-array. Optionally, has a clear value that is used to clear out array.
Attributes
- T
Type of the array element.
- height
Height of the array. Must be >= 0.
- width
Width of the array. Must be >= 0.
- Note:
If clear value is not set, the default clear value is
null
.- Companion:
- object
- Source:
- CPArray2D.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
Members list
Value members
Constructors
Creates 1x1 array with a given single value.
Creates 1x1 array with a given single value.
Attributes
- t
Value to set at [0,0] coordinate.
- Source:
- CPArray2D.scala
Creates w
xh
array with specified clear value.
Creates w
xh
array with specified clear value.
Attributes
- clearVal
Clear value.
- h
Array height.
- w
Array width.
- Source:
- CPArray2D.scala
Creates array with specified dimension and clear value.
Creates array with specified dimension and clear value.
Attributes
- clearVal
Clear value.
- dim
Array dimension.
- Source:
- CPArray2D.scala
Creates array with specified dimension.
Concrete methods
Clears this array with the clear value.
Clears this array with the clear value.
Attributes
- Note:
If the clear value is not set, the default value is
null
.- Source:
- CPArray2D.scala
Clears this array with given clear value.
Checks whether this array contains at least one element satisfying given predicate.
Checks whether this array contains at least one element satisfying given predicate.
Attributes
- p
Predicate to test.
- Source:
- CPArray2D.scala
Gets a deep copy of this array.
Copies a given frame into another 2D array.
Copies a given frame into another 2D array.
Attributes
- frame
A frame to copy.
- other
Another array to copy to.
- Source:
- CPArray2D.scala
Counts how many elements in this array satisfying given predicate.
Counts how many elements in this array satisfying given predicate.
Attributes
- p
Predicate to test.
- Source:
- CPArray2D.scala
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance
x
of typeAny
,x.equals(x)
should returntrue
. - It is symmetric: for any instances
x
andy
of typeAny
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any instances
x
,y
, andz
of typeAny
ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
.
If you override this method, you should verify that your implementation remains an equivalence relation.
Additionally, when overriding this method it is usually necessary to override hashCode
to ensure that
objects which are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int.
(o1.hashCode.equals(o2.hashCode)
).
Attributes
- that
the object to compare against this object for equality.
- Returns:
true
if the receiver object is equivalent to the argument;false
otherwise.- Definition Classes
- Any
- Source:
- CPArray2D.scala
Extracts deep copy sub-array with given shape.
Extracts deep copy sub-array with given shape.
Attributes
- rect
A shape to extract as a deep copy.
- Returns:
Deep copy sub-array with given shape.
- Source:
- CPArray2D.scala
Creates copy of this array with flipped X and Y coordinates.
Collapses given array into a single value given the initial value and associative binary operation acting as an accumulator. Folding over the elements in this 2D array will be horizontal first. In other words, given the 2D array with the following coordinates:
Collapses given array into a single value given the initial value and associative binary operation acting as an accumulator. Folding over the elements in this 2D array will be horizontal first. In other words, given the 2D array with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2)
Attributes
- op
Accumulating binary operation.
- z
Initial value.
- Source:
- CPArray2D.scala
Collapses given array into a single value given the initial value and associative binary operation acting as an accumulator. Folding over the elements in this 2D array will be vertical first. In other words, given the 2D array with the following coordinates:
Collapses given array into a single value given the initial value and associative binary operation acting as an accumulator. Folding over the elements in this 2D array will be vertical first. In other words, given the 2D array with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (2,0) (2,1) (2,2)
Attributes
- op
Accumulating binary operation.
- z
Initial value.
- Source:
- CPArray2D.scala
Calls given function for each array element.
Calls given function for each array element.
Attributes
- f
Function to call for each element.
- Source:
- CPArray2D.scala
Gets array value for given XY-coordinate.
Gets array value for given XY-coordinate.
Attributes
- x
X-coordinate.
- y
Y-coordinate.
- Source:
- CPArray2D.scala
Checks whether given XY-coordinate is valid for this array.
Checks whether given XY-coordinate is valid for this array.
Attributes
- x
X-coordinate to check.
- y
Y-coordinate to check.
- Source:
- CPArray2D.scala
Calls given function for each array element. Iteration over the elements in this 2D array will be horizontal first. In other words, given the 2D array with the following coordinates:
Calls given function for each array element. Iteration over the elements in this 2D array will be horizontal first. In other words, given the 2D array with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2)
Attributes
- f
Function to call for each element. The function takes value and its XY-coordinate in the array.
- See also:
- Source:
- CPArray2D.scala
Calls given function for each array element. Iteration over the elements in this 2D array will be horizontal first. In other words, given the 2D array with the following coordinates:
Calls given function for each array element. Iteration over the elements in this 2D array will be horizontal first. In other words, given the 2D array with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (1,0) (2,0) (0,1) (1,1) (2,1) (0,2) (1,2) (2,2)
Attributes
- f
Function to call for each element. The function takes value and its XY-coordinate in the array.
- See also:
- Source:
- CPArray2D.scala
Calls given function for each array element. Iteration over the elements in this 2D array will be vertical first. In other words, given the 2D array with the following coordinates:
Calls given function for each array element. Iteration over the elements in this 2D array will be vertical first. In other words, given the 2D array with the following coordinates:
+-----------------+
|(0,0) (1,0) (2,0)|
|(0,1) (1,1) (2,1)|
|(0,2) (1,2) (2,2)|
+-----------------+
this method will iterate in the following order:
(0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (2,0) (2,1) (2,2)
Attributes
- f
Function to call for each element. The function takes value and its XY-coordinate in the array.
- See also:
- Source:
- CPArray2D.scala
Maps this array to an array of different type.
Maps this array to an array of different type.
Attributes
- B
Type of the new array.
- f
Mapping function.
- Source:
- CPArray2D.scala
Map this array using extended mapping function.
Map this array using extended mapping function.
Attributes
- B
Type of the new array.
- f
Mapping function that takes value and its XY-coordinate in the array.
- Source:
- CPArray2D.scala
Sets array value at a given XY-coordinate.
Sets array value at a given XY-coordinate.
Attributes
- t
Value to set.
- x
X-coordinate.
- y
Y-coordinate.
- Source:
- CPArray2D.scala
Splits this array into num
evenly split sub-arrays.
Splits this array into num
evenly split sub-arrays.
Attributes
- num
Number of sub-arrays to split into.
- Returns:
Sequence of sub-arrays.
- Note:
num
must be > 0. If this array is empty, an empty sequence will be returned.- Source:
- CPArray2D.scala
Splits this array into a sequence of w
xh
arrays.
Splits this array into a sequence of w
xh
arrays.
Attributes
- h
Height of the split.
- w
Width of the split.
- Returns:
Sequence of
w
xh
arrays.- Note:
w
andh
must be > 0.Given
w
andh
must produce an even split. If this array is empty, an empty sequence will be returned.- Source:
- CPArray2D.scala
Creates new trimmed array with a given blank value.
Creates new trimmed array with a given blank value.
Attributes
- blank
Blank value to use for trimming.
- Note:
If trimming is not possible, returns this array.
- Source:
- CPArray2D.scala
Creates new trimmed array. Rows and columns are trimmed if all their values satisfy given predicate.
Creates new trimmed array. Rows and columns are trimmed if all their values satisfy given predicate.
Attributes
- f
Trimming predicate. If
true
the value will be considered blank.- Returns:
Trimmed out (smaller) copy of this array.
- Note:
If trimming is not possible, returns this array.
- Source:
- CPArray2D.scala
Concrete fields
Dimension of this array.
Attributes
- Source:
- CPArray2D.scala
Checks whether or not this array is empty, i.e. it's size == 0.
Checks whether or not this array is not empty, i.e. it's size != 0.
Checks whether or not this array is not empty, i.e. it's size != 0.
Attributes
- Source:
- CPArray2D.scala
Shape of this array as a rectangle.
Number of cells in this 2D array.
Attributes
- Source:
- CPArray2D.scala
Maximum X-coordinate. If width is zero this will equal to -1
.
Maximum Y-coordinate. If height is zero this will equal to -1
.