LSArray Class¶
- class
Value type for array expressions.
Such value is obtained with LSExpression::getArrayValue() or LSSolution::getArrayValue(const LSExpression). An array contains values of type lsint, lsdouble or LSArray (for multi-dimensional arrays). Note that it’s possible to mix integers or doubles in the same array.
Arrays are not decisions and cannot be modified.
See: LSSolution See: LSExpression Since: 7.5
Summary¶
count |
Returns the number of elements in the array. |
isBool |
Returns true if the value at the given position is a boolean. |
isInt |
Returns true if the value at the given position is an integer. |
isDouble |
Returns true if the value at the given position is a double. |
isArray |
Returns true if the value at the given position is an array. |
getIntValue |
Returns the integer value at the given position. |
getDoubleValue |
Returns the double value at the given position. |
getArrayValue |
Returns the array value at the given position. |
toString |
Returns a string representation of the values in the array in the format \u201c{ val0, val1, \u2026, valN }\u201d. |
Functions¶
-
int
localsolver::LSArray
::
count
()¶
const Returns the number of elements in the array.
Elements in arrays are indexed from 0 to count()-1.
-
bool
localsolver::LSArray
::
isBool
(int pos)¶
const Returns true if the value at the given position is a boolean.
You can retrieve the value with getIntValue.
Return: True if the value at the given position is a boolean. Parameters: pos - Position of the value to query.
-
bool
localsolver::LSArray
::
isInt
(int pos)¶
const Returns true if the value at the given position is an integer.
You can retrieve the value with getIntValue.
Return: True if the value at the given position is an integer. Parameters: pos - Position of the value to query.
-
bool
localsolver::LSArray
::
isDouble
(int pos)¶
const Returns true if the value at the given position is a double.
You can retrieve the value with getDoubleValue.
Return: True if the value at the given position is a double. Parameters: pos - Position of the value to query.
-
bool
localsolver::LSArray
::
isArray
(int pos)¶
const Returns true if the value at the given position is an array.
You can retrieve the value with getArrayValue.
Return: True if the value at the given position is an array. Parameters: pos - Position of the value to query.
-
lsint
localsolver::LSArray
::
getIntValue
(int pos)¶
const Returns the integer value at the given position.
If the value is neither an integer nor a boolean, an exception is thrown.
Return: Integer value. Parameters: pos - Position of the value to query.
-
lsdouble
localsolver::LSArray
::
getDoubleValue
(int pos)¶
const Returns the double value at the given position.
If the value is not a double, an exception is thrown.
Return: Double value. Parameters: pos - Position of the value to query.