Localsolver  6.0
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 is modified.

See Also
LSModel, LSExpression

Since version 5.5

Public Member Functions

void Add (long val)
 Adds the given value to this collection.
void Clear ()
 Removes 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 the values in the collection in the format "{ val0, val1, ..., valN }"

Properties

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

Member Function Documentation

void localsolver.LSCollection.Add ( long  val)

Adds the given value to this collection.

Only allowed in state LSState::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).

Parameters
valThe value to be added.
void localsolver.LSCollection.Clear ( )

Removes all values of this collection.

Only allowed in state LSState::Stopped.

long localsolver.LSCollection.Count ( )

Gets the number of values in the collection.

long localsolver.LSCollection.Get ( int  position)

Gets the value at the given position.

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

Gets the enumerator for the content of this collection.

override string localsolver.LSCollection.ToString ( )

Returns a string representation of the values in the collection in the format "{ val0, val1, ..., valN }"

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.