HxExternalArgumentValues Class

class hexaly.optimizer.HxExternalArgumentValues

Argument values for external functions. Argument values are used to query the values of the arguments passed to external functions.

Since:9.5

Summary

Methods
count Returns the number of values in the current argument values.
is_undefined Returns true if the argument at the given position has an undefined value.
is_bool Returns true if the value at the given position is a boolean.
is_int Returns true if the value at the given position is an integer.
is_double Returns true if the value at the given position is a double.
is_interval Returns true if the value at the given position is an interval.
is_collection Returns true if the value at the given position is a collection (list or set).
is_array Returns true if the value at the given position is an array.
get Returns the value at the given position.
get_int_value Returns the integer value at the given position.
get_double_value Returns the double value at the given position.
get_interval_value Returns the interval value at the given position.
get_collection_value Returns the collection value at the given position.
get_array_value Returns the array value at the given position.
Special methods
__len__ Returns the number of values in the current argument values.
__getitem__ Returns the value at the given position.

Instance methods

HxExternalArgumentValues.count()

Returns the number of values in the current argument values.

HxExternalArgumentValues.is_undefined(pos)

Returns true if the argument at the given position has an undefined value. An undefined value is often the result of an illegal or impossible operation. For example, the square root of a negative number, the addition of 2 opposite infinities, accessing an array or collection outside its bounds…

Attempting to access an argument with an undefined value will raise an exception. It is therefore recommended to check whether or not each argument is undefined before accessing its value. This is particularly true during the feasibility phase, when the probability of incorrect operations is very high.

Parameters:pos (int) – Position of the argument to query.
Returns:True if the argument at the given pos is undefined.
Return type:bool
HxExternalArgumentValues.is_bool(pos)

Returns true if the value at the given position is a boolean. You can retrieve the value with get().

Parameters:pos (int) – Position of the value to query.
Returns:True if the value at the given position is a boolean.
Return type:bool
HxExternalArgumentValues.is_int(pos)

Returns true if the value at the given position is an integer. You can retrieve the value with get() or get_int().

Parameters:pos (int) – Position of the value to query.
Returns:True if the value at the given position is an integer.
Return type:bool
HxExternalArgumentValues.is_double(pos)

Returns true if the value at the given position is a double. You can retrieve the value with get() or get_double().

Parameters:pos (int) – Position of the value to query.
Returns:True if the value at the given position is a double.
Return type:bool
HxExternalArgumentValues.is_interval(pos)

Returns true if the value at the given position is an interval. You can retrieve the value with get() or get_interval().

Parameters:pos (int) – Position of the value to query.
Returns:True if the value at the given position is an interval.
Return type:bool
HxExternalArgumentValues.is_collection(pos)

Returns true if the value at the given position is a collection (list or set). You can retrieve the value with get() or get_collection().

Parameters:pos (int) – Position of the value to query.
Returns:True if the value at the given position is an array.
Return type:bool
HxExternalArgumentValues.is_array(pos)

Returns true if the value at the given position is an array. You can retrieve the value with get() or get_array().

Parameters:pos (int) – Position of the value to query.
Returns:True if the value at the given position is an array.
Return type:bool
HxExternalArgumentValues.get(pos)

Returns the value at the given position. The returned value can be a boolean, an integer, a double, a HxInterval, a HxCollection or a HxArray.

Parameters:pos (int) – Position of the value to query.
Returns:Value
Return type:int, double, HxInterval, HxCollection or HxArray
HxExternalArgumentValues.get_int_value(pos)

Returns the integer value at the given position. The value must be an integer or a boolean. If not, an exception is thrown.

Parameters:pos (int) – Position of the value to query.
Returns:Value
Return type:int
Since:15.0
HxExternalArgumentValues.get_double_value(pos)

Returns the double value at the given position. The value must be a double. If not, an exception is thrown.

Parameters:pos (int) – Position of the value to query.
Returns:Value
Return type:double
Since:15.0
HxExternalArgumentValues.get_interval_value(pos)

Returns the interval value at the given position. The value must be an interval. If not, an exception is thrown.

Parameters:pos (int) – Position of the value to query.
Returns:Value
Return type:HxInterval
Since:15.0
HxExternalArgumentValues.get_collection_value(pos)

Returns the collection value at the given position. The value must be a collection. If not, an exception is thrown.

Parameters:pos (int) – Position of the value to query.
Returns:Value
Return type:HxCollection
Since:15.0
HxExternalArgumentValues.get_array_value(pos)

Returns the array value at the given position. The value must be an array. If not, an exception is thrown.

Parameters:pos (int) – Position of the value to query.
Returns:Value
Return type:HxArray
Since:15.0

Special operators and methods

HxExternalArgumentValues.__len__()

Returns the number of values in the current argument values. This method allows users to call len() function directly on the external argument values without using the count() method.

HxExternalArgumentValues.__getitem__(pos)

Returns the value at the given position. This method allows users to use [] operator directly on the external argument values without using the get() method.

Parameters:pos (int) – Position of the value to query.
Returns:Value
Return type:int, double, HxArray or HxCollection