Package localsolver.modeler
Class LSPValue
- java.lang.Object
-
- localsolver.modeler.LSPValue
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class LSPValue extends java.lang.Object implements java.lang.AutoCloseableGeneral value container. Any value in an LSPModeler 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanasBool()Returns the value as a boolean.doubleasDouble()Returns the value as a double.LSExpressionasExpression()Returns the value as aLSExpression.LSPFunctionasFunction()Returns the value as aLSPFunction.longasInt()Returns the value as an integer.LSPMapasMap()Returns the value as aLSPMap.LSPModuleasModule()Returns the value as aLSPModule.java.lang.StringasString()Returns the value as a String.voidclose()Releases the reference.booleanequals(java.lang.Object obj)LSPTypegetType()Returns the type of the value.inthashCode()booleanisBool()Returns true if the value is a boolean value.booleanisDouble()Returns true if the value is a double value.booleanisExpression()Returns true if the value is an LSExpression.booleanisFunction()Returns true if the value is a LSPFunction.booleanisInt()Returns true if the value is an integer value.booleanisMap()Returns true if the value is an LSPMap.booleanisModule()Returns true if the value is an LSPModule.booleanisNil()Returns true if the value is nil.booleanisString()Returns true if the value is a string.
-
-
-
Method Detail
-
close
public void close()
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.
- Specified by:
closein interfacejava.lang.AutoCloseable- Since:
- 11.0
-
getType
public LSPType getType()
Returns the type of the value.- Returns:
- Type of the value.
- See Also:
LSPType
-
isInt
public boolean isInt()
Returns true if the value is an integer value.
-
isDouble
public boolean isDouble()
Returns true if the value is a double value.
-
isBool
public boolean isBool()
Returns true if the value is a boolean value.
-
isMap
public boolean isMap()
Returns true if the value is an LSPMap.
-
isModule
public boolean isModule()
Returns true if the value is an LSPModule.
-
isExpression
public boolean isExpression()
Returns true if the value is an LSExpression.
-
isFunction
public boolean isFunction()
Returns true if the value is a LSPFunction.
-
isString
public boolean isString()
Returns true if the value is a string.
-
isNil
public boolean isNil()
Returns true if the value is nil.
-
asInt
public long asInt()
Returns the value as an integer. The value must be an integer.
-
asDouble
public double asDouble()
Returns the value as a double. The value must be a double.
-
asBool
public boolean asBool()
Returns the value as a boolean. The value must be a boolean.
-
asString
public java.lang.String asString()
Returns the value as a String. The value must be a string.
-
asFunction
public LSPFunction asFunction()
Returns the value as aLSPFunction. The value must be a function.
-
asExpression
public LSExpression asExpression()
Returns the value as aLSExpression. The value must be an expression.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-