Detailed Description
Value type for collection expressions (lists).
Such a value is obtained with LSExpression::getCollectionValue(). It represents a reference to the value of a variable and the value of this variable is modified when the LSCollection object if modified.
- See Also
- LSModel
-
LSExpression
- Since
- 5.5
Public Member Functions |
int | getIndex () const |
| Gets the index of the corresponding expression in the model.
|
void | add (lsint val) |
| Adds the given value to this collection.
|
void | clear () |
| Remove all values of this collection.
|
lsint | count () const |
| Gets the number of values in the collection.
|
lsint | get (int position) const |
| Gets the value at the given position.
|
lsint | operator[] (int i) const |
| operator overloading for get
|
std::string | toString () const |
| Returns a string representation of this expression.
|
Member Function Documentation
int localsolver::LSCollection::getIndex |
( |
| ) |
const |
|
inline |
Gets the index of the corresponding expression in the model.
- Returns
- Index in the model.
void localsolver::LSCollection::add |
( |
lsint |
val | ) |
|
|
inline |
Adds the given value to this collection.
Only allowed in state S_Modeling. This function will fail if the given value is outside of the range of the list or if this value is already included in this list (remind that a list cannot contain twice the same value.
- Parameters
-
val | The value to be added. |
void localsolver::LSCollection::clear |
( |
| ) |
|
|
inline |
Remove all values of this collection.
Only allowed in state S_Modeling.
lsint localsolver::LSCollection::count |
( |
| ) |
const |
|
inline |
Gets the number of values in the collection.
lsint localsolver::LSCollection::get |
( |
int |
position | ) |
const |
|
inline |
Gets the value at the given position.
- Parameters
-
position | The considered position (must be non negative and striclty smaller than the number of values in the collection). |
lsint localsolver::LSCollection::operator[] |
( |
int |
i | ) |
const |
|
inline |
operator overloading for get
std::string localsolver::LSCollection::toString |
( |
| ) |
const |
|
inline |
Returns a string representation of this expression.
This representation provides the index of the expression, its type, and its name (if any). Useful for debugging or logging purposes.
- Returns
- String representation.