public class LSPModule
extends java.lang.Object
LSPMap, LSPFunction...) or manipulated with an LSPValue
which is a container that can hold any type of value. Using the native type is
more convenient and results in less overhead most of the time. LSPValue
should only be used when you don't know the type of the manipulated value.| Modifier and Type | Method and Description |
|---|---|
LSPValue |
asValue()
Returns the module as an
LSPValue. |
boolean |
equals(java.lang.Object obj) |
boolean |
getBool(java.lang.String varName)
Returns the boolean variable with the given name.
|
double |
getDouble(java.lang.String varName)
Returns the double variable with the given name.
|
LSExpression |
getExpression(java.lang.String varName)
Returns the
LSExpression with the given name. |
LSPFunction |
getFunction(java.lang.String varName)
Returns the
LSPFunction with the given name. |
long |
getInt(java.lang.String varName)
Returns the integer variable with the given name.
|
LSPMap |
getMap(java.lang.String varName)
Returns the
LSPMap with the given name. |
LSPModule |
getModule(java.lang.String varName)
Returns the
LSPModule with the given name. |
java.lang.String |
getString(java.lang.String varName)
Returns the string with the given name.
|
LSPType |
getType(java.lang.String varName)
Returns the type of the variable with the given name.
|
LSPValue |
getValue(java.lang.String varName)
Returns the
LSPValue with the given name. |
int |
hashCode() |
boolean |
isBool(java.lang.String varName)
Returns true if the variable with the given name
exists and holds a boolean value.
|
boolean |
isDouble(java.lang.String varName)
Returns true if the variable with the given name
exists and holds a double value.
|
boolean |
isExpression(java.lang.String varName)
Returns true if the variable with the given name
exists and holds an
LSExpression. |
boolean |
isFunction(java.lang.String varName)
Returns true if the variable with the given name
exists and holds an
LSPFunction. |
boolean |
isInt(java.lang.String varName)
Returns true if the variable with the given name
exists and holds an integer value.
|
boolean |
isMap(java.lang.String varName)
Returns true if the variable with the given name
exists and holds an
LSPMap. |
boolean |
isModule(java.lang.String varName)
Returns true if the variable with the given name
exists and holds an
LSPModule. |
boolean |
isNil(java.lang.String varName)
Returns true if no variable with this name exists
in the module or if the variable holds a nil value.
|
boolean |
isString(java.lang.String varName)
Returns true if the variable with the given name
exists and holds a string value.
|
void |
parseArguments(java.util.List<java.lang.String> arguments)
Parses the list of arguments and import them in the module.
|
void |
parseArguments(java.lang.String... arguments)
Parses the list of arguments and import them in the module.
|
void |
run()
Entry point to the execution of a module.
|
void |
run(java.util.List<java.lang.String> arguments)
Entry point to the execution of a module.
|
void |
run(java.lang.String... arguments)
Entry point to the execution of a module.
|
void |
setBool(java.lang.String varName,
boolean value)
Sets the boolean value associated with the variable with the given name.
|
void |
setDouble(java.lang.String varName,
double value)
Sets the double value associated with the variable with the given name.
|
void |
setExpression(java.lang.String varName,
LSExpression expr)
Sets the
LSExpression associated with the variable with the given name. |
void |
setFunction(java.lang.String varName,
LSPFunction function)
Sets the
LSPFunction associated with the variable with the given name. |
void |
setInt(java.lang.String varName,
long value)
Sets the integer value associated with the variable with the given name.
|
void |
setMap(java.lang.String varName,
LSPMap map)
Sets the
LSPMap associated with the variable with the given name. |
void |
setModule(java.lang.String varName,
LSPModule module)
Sets the
LSPModule associated with the variable with the given name. |
void |
setNil(java.lang.String varName)
Unsets the variable with the given name.
|
void |
setString(java.lang.String varName,
java.lang.String str)
Sets the string associated with the variable with the given name.
|
void |
setValue(java.lang.String varName,
LSPValue value)
Sets the value associated with the variable with the given name.
|
void |
unset(java.lang.String varName)
Unsets the variable with the given name.
|
public void parseArguments(java.util.List<java.lang.String> arguments)
argName=argValue.arguments - List of arguments.public void parseArguments(java.lang.String... arguments)
argName=argValue.arguments - List of arguments.public void run()
input function is executed if it exists in the
module.model function is executed (it must be declared
in the module).LSModel is then closed.param function is executed if it exists in the
module.LocalSolver.solve() is called on the
corresponding solver instance. If the display function
is defined, it will be called during the resolution process.output function is executed if it exists in
the module.public void run(java.util.List<java.lang.String> arguments)
parseArguments(java.util.List<java.lang.String>) before calling
run().arguments - List of arguments.parseArguments(java.util.List<java.lang.String>),
run()public void run(java.lang.String... arguments)
parseArguments(java.util.List<java.lang.String>) before calling
run().arguments - List of arguments.parseArguments(java.util.List<java.lang.String>),
run()public LSPType getType(java.lang.String varName)
LSPType.Nil is returned.varName - Name of the variable.LSPTypepublic LSPValue getValue(java.lang.String varName)
LSPValue with the given name. If the variable does
not exist, an LSPValue representing a nil value is returned.varName - Name of the variable.LSPValuepublic long getInt(java.lang.String varName)
varName - Name of the variable.public double getDouble(java.lang.String varName)
varName - Name of the variable.public boolean getBool(java.lang.String varName)
varName - Name of the variable.public LSExpression getExpression(java.lang.String varName)
LSExpression with the given name. The variable
must exist and must hold a value of type LSPType.Expression.varName - Name of the variable.public java.lang.String getString(java.lang.String varName)
varName - Name of the variable.public LSPFunction getFunction(java.lang.String varName)
LSPFunction with the given name. The variable must
exist and must hold a function.varName - Name of the variable.public LSPMap getMap(java.lang.String varName)
LSPMap with the given name. The variable must
exist and must hold a map.varName - Name of the variable.public LSPModule getModule(java.lang.String varName)
LSPModule with the given name. The variable must
exist and must hold a module.varName - Name of the variable.public void setValue(java.lang.String varName,
LSPValue value)
varName - Name of the variable.value - Value of the variable.public void setInt(java.lang.String varName,
long value)
varName - Name of the variable.value - Value of the variable.public void setDouble(java.lang.String varName,
double value)
varName - Name of the variable.value - Value of the variable.public void setBool(java.lang.String varName,
boolean value)
varName - Name of the variable.value - Value of the variable.public void setExpression(java.lang.String varName,
LSExpression expr)
LSExpression associated with the variable with the given name.
The variable is automatically created if it doesn't exist in the module.varName - Name of the variable.expr - Value of the variable.public void setString(java.lang.String varName,
java.lang.String str)
varName - Name of the variable.str - Value of the variable.public void setFunction(java.lang.String varName,
LSPFunction function)
LSPFunction associated with the variable with the given name.
The variable is automatically created if it doesn't exist in the module.varName - Name of the variable.function - Value of the variable.public void setMap(java.lang.String varName,
LSPMap map)
LSPMap associated with the variable with the given name.
The variable is automatically created if it doesn't exist in the module.varName - Name of the variable.map - Value of the variable.public void setModule(java.lang.String varName,
LSPModule module)
LSPModule associated with the variable with the given name.
The variable is automatically created if it doesn't exist in the module.varName - Name of the variable.module - Value of the variable.public void setNil(java.lang.String varName)
varName - Name of the variable.public void unset(java.lang.String varName)
varName - Name of the variable.public boolean isInt(java.lang.String varName)
varName - Name of the variable.public boolean isDouble(java.lang.String varName)
varName - Name of the variable.public boolean isBool(java.lang.String varName)
varName - Name of the variable.public boolean isExpression(java.lang.String varName)
LSExpression.varName - Name of the variable.public boolean isString(java.lang.String varName)
varName - Name of the variable.public boolean isFunction(java.lang.String varName)
LSPFunction.varName - Name of the variable.public boolean isMap(java.lang.String varName)
LSPMap.varName - Name of the variable.public boolean isModule(java.lang.String varName)
LSPModule.varName - Name of the variable.public boolean isNil(java.lang.String varName)
varName - Name of the variable.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object