public class LSCollection
extends java.lang.Object
implements java.lang.Iterable<java.lang.Long>
LSExpression.getCollectionValue()
or LSSolution.getCollectionValue(LSExpression)
.
It represents a reference to the value of a variable and the value of this variable
is modified when the LSCollection object is modified.LSModel
,
LSExpression
Modifier and Type | Method and Description |
---|---|
void |
add(long val)
Adds the given value to this collection.
|
void |
clear()
Removes all values of this collection.
|
boolean |
contains(long value)
Returns true if the collection contains the given value, false otherwise.
|
int |
count()
Returns the number of values in the collection.
|
boolean |
equals(java.lang.Object obj) |
long |
get(int position)
Gets the value at the given position.
|
int |
hashCode() |
java.util.Iterator<java.lang.Long> |
iterator()
Returns an iterator for the content of this collection.
|
java.lang.String |
toString()
Returns a string representation of the values in the collection in the format
"{ val0, val1, ..., valN }"
|
public void add(long val)
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 (keep in mind that a list cannot contain twice the same value).val
- The value to be added.public void clear()
LSState.Stopped
.public int count()
public long get(int position)
position
- The considered position (must be non negative and
strictly smaller than the number of values in the collection).public boolean contains(long value)
value
- Element whose presence in this collection is to be tested.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.util.Iterator<java.lang.Long> iterator()
iterator
in interface java.lang.Iterable<java.lang.Long>