new Index(values)
- Source:
Immutable index. Warning: the input array is NOT cloned, modifying it will modify the index values.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array | The index values. |
Methods
add(rhs) → {dwv.math.Index}
- Source:
Add another index to this one.
Parameters:
Name | Type | Description |
---|---|---|
rhs |
dwv.math.Index | The index to add. |
Returns:
The index representing the sum of both indices.
- Type
- dwv.math.Index
canCompare(rhs) → {boolean}
- Source:
Check if the input index can be compared to this one.
Parameters:
Name | Type | Description |
---|---|---|
rhs |
dwv.math.Index | The index to compare to. |
Returns:
True if both indices are comparable.
- Type
- boolean
equals(rhs) → {boolean}
- Source:
Check for Index equality.
Parameters:
Name | Type | Description |
---|---|---|
rhs |
dwv.math.Index | The index to compare to. |
Returns:
True if both indices are equal.
- Type
- boolean
get(i) → {number}
- Source:
Get the index value at the given array index.
Parameters:
Name | Type | Description |
---|---|---|
i |
number | The index to get. |
Returns:
The value.
- Type
- number
getValues() → {Array}
- Source:
Get the values of this index.
Returns:
The array of values.
- Type
- Array
getWithNew2D(i, j) → {dwv.math.Index}
- Source:
Get the current index with a new 2D base.
Parameters:
Name | Type | Description |
---|---|---|
i |
number | The new 0 index. |
j |
number | The new 1 index. |
Returns:
The new index.
- Type
- dwv.math.Index
length() → {number}
- Source:
Get the length of the index.
Returns:
The length.
- Type
- number
toString() → {string}
- Source:
Get a string representation of the Index.
Returns:
The Index as a string.
- Type
- string
toStringId(dims) → {string}
- Source:
Get a string id from the index values in the form of: '#0-1_#1-2'.
Parameters:
Name | Type | Description |
---|---|---|
dims |
Array | Optional list of dimensions to use. |
Returns:
The string id.
- Type
- string