Localsolver  5.5
localsolver.LSCollection Class Reference

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.

LSModel LSExpression Since version 5.5

Public Member Functions

int GetIndex ()
 Gets the index of the corresponding expression in the model.
void Add (long val)
 Adds the given value to this collection.
void Clear ()
 Remove all values of this collection.
long Count ()
 Gets the number of values in the collection.
long Get (int position)
 Gets the value at the given position.
IEnumerator< long > GetEnumerator ()
 Gets the enumerator for the content of this collection.
override string ToString ()
 Returns a string representation of this expression.

Properties

long this[int key] [get]
 Gets the value at the given position.

Member Function Documentation

int localsolver.LSCollection.GetIndex ( )
inline

Gets the index of the corresponding expression in the model.

Returns
Index in the model.
void localsolver.LSCollection.Add ( long  val)
inline

Adds the given value to this collection.

Only allowed in state LSState.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
valThe value to be added.
void localsolver.LSCollection.Clear ( )
inline

Remove all values of this collection.

Only allowed in state LSState.Modeling.

long localsolver.LSCollection.Count ( )
inline

Gets the number of values in the collection.

long localsolver.LSCollection.Get ( int  position)
inline

Gets the value at the given position.

Parameters
positionThe considered position (must be non negative and striclty smaller than the number of values in the collection).
IEnumerator<long> localsolver.LSCollection.GetEnumerator ( )
inline

Gets the enumerator for the content of this collection.

override string localsolver.LSCollection.ToString ( )
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.

Property Documentation

long localsolver.LSCollection.this[int key]
get

Gets the value at the given position.

Parameters
keyThe considered position (must be non negative and striclty smaller than the number of values in the collection).