Package localsolver.modeler
Class LSPFunction
- java.lang.Object
-
- localsolver.modeler.LSPFunction
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class LSPFunction extends java.lang.Object implements java.lang.AutoCloseable
A function can be either user-defined function or built-in function. It is possible to create external functions from the modeler API and call them in the modeler. SeeLSPFunctor
for more information on how to create external functions.- Since:
- 10.0
- See Also:
LSPFunctor
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LSPValue
asValue()
Gets the LSPFunction as LSPValue.LSPValue
call()
Calls the function with no argument.LSPValue
call(java.util.List<LSPValue> arguments)
Calls the function with the provided arguments.LSPValue
call(LSPValue... arguments)
Calls the function with the provided arguments.void
close()
Releases the reference.boolean
equals(java.lang.Object obj)
java.lang.String
getDeclaredName()
Gets the name of the function.int
hashCode()
-
-
-
Method Detail
-
close
public void close()
Releases the reference. If this function 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 function object is destroyed. It is only destroyed if no more references point to it.
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Since:
- 11.5
-
getDeclaredName
public java.lang.String getDeclaredName()
Gets the name of the function. The name of the function does not necessarily reflect the name of the variable(s) to which the function is associated. The name is mainly used to identify the function in stack traces when exceptions occur.
-
call
public LSPValue call()
Calls the function with no argument.- Returns:
- Return value of the call.
- See Also:
LSPValue
-
call
public LSPValue call(LSPValue... arguments)
Calls the function with the provided arguments.- Parameters:
arguments
- List of arguments.- Returns:
- Return value of the call.
- See Also:
LSPValue
-
call
public LSPValue call(java.util.List<LSPValue> arguments)
Calls the function with the provided arguments.- Parameters:
arguments
- List of arguments- Returns:
- Return value of the call.
- See Also:
LSPValue
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-