LSArray Class¶
- class LSArray¶
Value type for array expressions. An array can contain numbers (int, double), other LSArray (for multi-dimensional arrays), LSInterval or LSCollection (list, set). Arrays are not decisions and cannot be modified. Such a value is obtained with
LSExpression.value
or withLSSolution.getValue()
.- See:
- See:
Summary¶
Returns the number of values in the array. |
|
If an argument is passed to the function, returns true if the value at the given position is undefined, otherwise returns true if the array itself is undefined. |
Returns an iterator than can be used within a for statement. |
|
Indexer. |
Functions¶
- LSArray.count()¶
Returns the number of values in the array. Elements in arrays are indexed from 0 to count()-1.
- Returns:
Number of values in the array.
- Return type:
int
- LSArray.isUndefined(position)¶
- LSArray.isUndefined()
If an argument is passed to the function, returns true if the value at the given position is undefined, otherwise returns true if the array itself is undefined. A value can be undefined in 4 cases:
It is a double and its value is NaN (Not a Number).
It is an integer or boolean with no valid value (arithmetic or out of bounds exception).
It is an interval with at least one undefined bound.
It is the result of any ill-defined operation (at with out of bounds index or operations on undefined values for instance).
- Parameters:
position (int) – Position of the value to query.
- Returns:
True if the value at the given position is undefined, or if the array is undefined if no argument is passed.
- Return type:
bool
Overloaded operators¶
- LSArray.iterator()¶
Returns an iterator than can be used within a
for
statement.
- LSArray.index(position)¶
Indexer. Gets the value at the given position.
- Parameters:
position (int) – The considered position. Must be non negative and striclty smaller than the number of values in the array.
- Returns:
The value at the given position