Class Function
- java.lang.Object
-
- ru.ispras.fortress.solver.function.Function
-
public final class Function extends java.lang.Object
The Function class describes a custom function that extends the functionality of a solver. A function represents an operation described in terms of expressions that use existing solver operations.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
getBody()
Returns the body of the function (underlying expression).java.lang.Enum<?>
getId()
Returns the identifier of the operation associated with the function.Variable
getParameter(int index)
Returns function parameters by their index.int
getParameterCount()
Returns the parameter count.DataType
getReturnType()
Returns the function return type.java.lang.String
getUniqueName()
Returns a unique name for the function.
-
-
-
Constructor Detail
-
Function
public Function(java.lang.Enum<?> id, DataType returnType, Node body, Variable... parameters)
Creates a function with a variable number of parameters.- Parameters:
id
- The identifier of the operator the function is associated with.returnType
- The function return type.body
- The body of the function (underlying expression).parameters
- An variable-length list of parameters.- Throws:
java.lang.IllegalArgumentException
- if any of the parameters isnull
.
-
-
Method Detail
-
getId
public java.lang.Enum<?> getId()
Returns the identifier of the operation associated with the function.- Returns:
- Operation identifier for the function.
-
getUniqueName
public java.lang.String getUniqueName()
Returns a unique name for the function. The name is based on the function's identifier, return value type and parameter types. It helps distinguish overloaded functions that use the same identifier but have different parameter type and return types.- Returns:
- Unique name of the function.
-
getReturnType
public DataType getReturnType()
Returns the function return type.- Returns:
- The function return type.
-
getBody
public Node getBody()
Returns the body of the function (underlying expression).- Returns:
- The syntax element describing the body of the function.
-
getParameterCount
public int getParameterCount()
Returns the parameter count.- Returns:
- The number of parameters.
-
getParameter
public Variable getParameter(int index)
Returns function parameters by their index.- Parameters:
index
- The index of the needed parameter.- Returns:
- A function parameter.
- Throws:
java.lang.IndexOutOfBoundsException
- if the parameter index is out of bounds of the parameter array.
-
-