HxCollection Class¶
- class HxCollection¶
Value type for collection expressions (lists or sets). Such a value is obtained with
HxExpression.value
or withHxSolution.getValue()
.- See:
- See:
Summary¶
Adds the given value to this collection. |
|
Removes all values of this collection. |
|
Returns the number of values in the collection. |
|
Returns true if the collection contains the given value, false otherwise. |
|
Returns true if the collection is undefined. |
Returns an iterator than can be used within a for statement. |
|
Indexer. |
Methods¶
- HxCollection.add(val)¶
Adds the given value to this collection. Only allowed in state
STOPPED
. This function will fail if the given value is not an integer, 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).
- HxCollection.clear()¶
Removes all values of this collection. Only allowed in state
STOPPED
.
- HxCollection.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
- HxCollection.contains(value)¶
Returns true if the collection contains the given value, false otherwise. An exception will be thrown if the provided value is not an integer.
- Parameters:
value (int) – Element whose presence in this collection is to be tested.
- Return type:
bool
- HxCollection.isUndefined()¶
Returns true if the collection is undefined. A collection can be undefined if it is the result of any ill-defined operation (at with out of bounds index or operations on undefined values for instance).
- Returns:
True if the collection is undefined.
- Return type:
bool
Overloaded operators¶
- HxCollection.iterator()¶
Returns an iterator than can be used within a
for
statement.
- HxCollection.index(position)¶
Indexer. Gets the value at the given position.
- Parameters:
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:
int