LSCollection Class¶
-
class
localsolver.
LSCollection
¶ Value type for collection expressions (lists or sets). 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 is modified.Since: 5.5 See: LSModel See: LSExpression See: LSOperator.List
Summary¶
Add |
Adds the given value to this collection. |
Clear |
Removes all values of this collection. |
Count |
Returns the number of values in the collection. |
Get |
Gets the value at the given position. |
Contains |
Returns true if the collection contains the given value, false otherwise. |
GetEnumerator |
Gets the enumerator for the content of this collection. |
ToString |
Returns a string representation of the values in the collection in the format { val0, val1, ..., valN }. |
this |
Indexer. |
Instance methods¶
-
void
Add
(long val)¶ Adds the given value to this collection. Only allowed in state
Stopped
. This function will fail if the given value is outside of the domain of the list or if this value is already included in this list (keep in mind that a list cannot contain twice the same value).Arguments: val (long) – The value to be added.
-
int
Count
()¶ Returns the number of values in the collection. Elements in collections are indexed from 0 to count()-1.
Returns: Number of values in the collection. Return type: int
-
long
Get
(int position)¶ Gets the value at the given position.
Arguments: position (int) – The considered position (must be non negative and strictly smaller than the number of values in the collection). Returns: The value at the given position Return type: long
-
bool
Contains
(long value)¶ Returns true if the collection contains the given value, false otherwise.
Arguments: value (long) – Element whose presence in this collection is to be tested. Returns: True if the collection contains the value Return type: bool
-
IEnumerator<long>
GetEnumerator
()¶ -
IEnumerator
GetEnumerator
() Gets the enumerator for the content of this collection.
-
string
ToString
()¶ Returns a string representation of the values in the collection in the format
{ val0, val1, ..., valN }
.Returns: A String representation of the collection Return type: string
Overloaded operators and indexers¶
-
long
this
(int position)¶ Indexer. Gets the value at the given position.
Arguments: position (int) – The considered position. Must be non negative and striclty smaller than the number of values in the collection. Returns: The value at the given position Return type: long