LSCollection Class¶
-
class
localsolver.LSCollection¶ 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 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 |
Gets the number of values in the collection. |
Get |
Gets the value at the given position. |
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 range of the list or if this value is already included in this list (remind that a list cannot contain twice the same value).Arguments: val (long) – The value to be added.
-
long
Count()¶ Gets the number of values in the collection.
Returns: Number of values in the collection. Return type: long
-
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
-
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