LocalSolver logo
is now
Hexaly logo

We're excited to share that we are moving forward. We're leaving behind the LocalSolver brand and transitioning to our new identity: Hexaly. This represents a leap forward in our mission to enable every organization to make better decisions faster when faced with operational and strategic challenges.


LSPValue Class

class localsolver.modeler.LSPValue

General value container. Any value can be contained in an instance of this class (integer, double, boolean, string, LSExpression, module, map, function and also non exposed types like files or dates).

Since:

10.0

Summary

Methods

GetValueType

Returns the type of the value.

IsNil

Returns true if the value is a nil value.

IsInt

Returns true if the value is an integer value.

IsDouble

Returns true if the value is a double value.

IsBool

Returns true if the value is a boolean value.

IsString

Returns true if the value is a string value.

IsExpression

Returns true if the value is a LSExpression.

IsFunction

Returns true if the value is a LSPFunction.

IsModule

Returns true if the value is a LSPModule.

IsMap

Returns true if the value is a LSPMap.

AsInt

Returns the value as an integer.

AsDouble

Returns the value as a double.

AsBool

Returns the value as a boolean.

AsString

Returns the value as a string.

AsExpression

Returns the value as an expression.

AsFunction

Returns the value as a function.

AsModule

Returns the value as a module.

AsMap

Returns the value as a map.

Dispose

Releases the reference.

Instance methods

LSPType GetValueType()

Returns the type of the value.

Returns:

The type of the value.

Return type:

LSPType

bool IsNil()

Returns true if the value is a nil value.

bool IsInt()

Returns true if the value is an integer value.

bool IsDouble()

Returns true if the value is a double value.

bool IsBool()

Returns true if the value is a boolean value.

bool IsString()

Returns true if the value is a string value.

bool IsExpression()

Returns true if the value is a LSExpression.

bool IsFunction()

Returns true if the value is a LSPFunction.

bool IsModule()

Returns true if the value is a LSPModule.

bool IsMap()

Returns true if the value is a LSPMap.

long AsInt()

Returns the value as an integer. The value must be an integer.

Returns:

Integer value.

Return type:

long

double AsDouble()

Returns the value as a double. The value must be a double.

Returns:

Double value.

Return type:

double

bool AsBool()

Returns the value as a boolean. The value must be a boolean.

Returns:

Boolean value.

Return type:

bool

string AsString()

Returns the value as a string. The value must be a string.

Returns:

String value.

Return type:

string

LSExpression AsExpression()

Returns the value as an expression. The value must be a LSExpression.

Returns:

Expression value.

Return type:

LSExpression

LSPFunction AsFunction()

Returns the value as a function. The value must be a LSPFunction.

Returns:

Function value.

Return type:

LSPFunction

LSPModule AsModule()

Returns the value as a module. The value must be a LSPModule.

Returns:

Module value.

Return type:

LSPModule

LSPMap AsMap()

Returns the value as a map. The value must be a LSPMap.

Returns:

Map value.

Return type:

LSPMap

void Dispose()

Releases the reference. If this value was already released, returns immediately and does nothing. Invoking any method on this object after this operation will throw an exception.

Note: Releasing a reference does not necessarily imply that the underlying value object is destroyed. It is only destroyed if no more references point to it.

Since:

11.5