HxCollection Class¶
-
class HxCollection¶
Value type for collection expressions (lists or sets). Such value is obtained with
HxExpression::getCollectionValue()
orHxSolution::getCollectionValue()
. It represents a reference to the value of a variable and the value of this variable is modified when the HxCollection object is modified.- See:
HxSolution
- See:
HxExpression
- Since:
5.5
Summary¶
Adds the given value to this collection. |
|
Removes all values of this collection. |
|
Returns the number of values in the collection. |
|
Gets the value at the given position. |
|
Returns true if the collection contains the given value, false otherwise. |
|
Returns true if the collection is undefined. |
|
Returns a string representation of the values in the collection in the format { val0, val1, ..., valN }. |
Operator overloading for get. |
Functions¶
-
void HxCollection::add(hxint val)¶
Adds the given value to this collection. Only allowed in state
S_Stopped
. This function will fail if the given value is outside of the domain of the list/set or if this value is already included in this list/set (keep in mind that a list or a set cannot contain twice the same value).- Parameters:
val – The value to be added.
-
void HxCollection::clear()¶
Removes all values of this collection. Only allowed in state
S_Stopped
.
-
int HxCollection::count() const¶
Returns the number of values in the collection. Values in collections are indexed from 0 to count()-1.
-
hxint HxCollection::get(int position) const¶
Gets the value at the given position.
- Parameters:
position – The considered position (must be non negative and strictly smaller than the number of values in the collection).
-
bool HxCollection::contains(hxint value) const¶
Returns true if the collection contains the given value, false otherwise.
- Parameters:
value – element whose presence in this collection is to be tested
-
bool HxCollection::isUndefined() const¶
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.
-
std::string HxCollection::toString() const¶
Returns a string representation of the values in the collection in the format
{ val0, val1, ..., valN }
.- Returns:
String representation.
Overloaded operators¶
-
hxint HxCollection::operator[](int position) const¶
Operator overloading for get.
- Parameters:
position – The considered position (must be non negative and strictly smaller than the number of values in the collection).