HxArray Class

class HxArray

Value type for array expressions. An array can contain numbers (int, double), other HxArray (for multi-dimensional arrays), HxInterval or HxCollection (list, set). Arrays are not decisions and cannot be modified. Such a value is obtained with HxExpression.value or with HxSolution.getValue().

See:

HxModel

See:

HxExpression

Summary

Methods

count

Returns the number of values in the array.

isUndefined

If an argument is passed to the function, returns true if the value at the given position is undefined, otherwise returns true if the array itself is undefined.

Overloaded operators

iterator

Returns an iterator than can be used within a for statement.

index

Indexer.

Functions

HxArray.count()

Returns the number of values in the array. Elements in arrays are indexed from 0 to count()-1.

Returns:

Number of values in the array.

Return type:

int

HxArray.isUndefined(position)
HxArray.isUndefined()

If an argument is passed to the function, returns true if the value at the given position is undefined, otherwise returns true if the array itself is undefined. A value can be undefined in 4 cases:

  • It is a double and its value is NaN (Not a Number).

  • It is an integer or boolean with no valid value (arithmetic or out of bounds exception).

  • It is an interval with at least one undefined bound.

  • It is the result of any ill-defined operation (at with out of bounds index or operations on undefined values for instance).

Parameters:

position (int) – Position of the value to query.

Returns:

True if the value at the given position is undefined, or if the array is undefined if no argument is passed.

Return type:

bool

Overloaded operators

HxArray.iterator()

Returns an iterator than can be used within a for statement.

HxArray.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 array.

Returns:

The value at the given position