Package org.moeaframework.util.tree
Class Lambda
java.lang.Object
org.moeaframework.util.tree.Node
org.moeaframework.util.tree.Lambda
- All Implemented Interfaces:
Serializable
The node for defining an immutable, anonymous function. Unlike
Define
, the behavior (body) of a
Lambda
can not be modified. Therefore, Lambda
s are useful for providing pre-defined functions
built using existing Node
s.- See Also:
-
Constructor Summary
ConstructorDescriptionConstructs a new node for defining an immutable, anonymous function with no arguments.Constructs a new node for defining an immutable, anonymous function with a user-defined number of arguments.Constructs a new node for defining an immutable, anonymous function with one argument.Constructs a new node for defining an immutable, anonymous function with two arguments. -
Method Summary
Modifier and TypeMethodDescriptioncopyNode()
Returns a copy of this node, but without any children or parents assigned.evaluate
(Environment environment) Evaluates this node in the context of the specified environment.Methods inherited from class org.moeaframework.util.tree.Node
copyTree, getArgument, getArgumentType, getDepth, getFunctionAt, getFunctionAt, getMaximumHeight, getMinimumHeight, getNodeAt, getNodeAt, getNodeAt, getNumberOfArguments, getNumberOfFunctions, getNumberOfFunctions, getNumberOfNodes, getNumberOfNodes, getNumberOfNodes, getNumberOfTerminals, getNumberOfTerminals, getParent, getReturnType, getTerminalAt, getTerminalAt, isFixed, isTerminal, isValid, setArgument, setFixed, setFixedTree, size, toString
-
Constructor Details
-
Lambda
Constructs a new node for defining an immutable, anonymous function with no arguments.- Parameters:
node
- the body of this function- Throws:
IllegalArgumentException
- ifnode
is incomplete or not strongly typed (i.e.,node.isValid()
returnsfalse
)
-
Lambda
Constructs a new node for defining an immutable, anonymous function with one argument.- Parameters:
node
- the body of this functionvariableName
- the name of the argumentvariableType
- the type of the argument- Throws:
IllegalArgumentException
- ifnode
is incomplete or not strongly typed (i.e.,node.isValid()
returnsfalse
)
-
Lambda
Constructs a new node for defining an immutable, anonymous function with two arguments.- Parameters:
node
- the body of this functionname1
- the name of the first argumenttype1
- the type of the first argumentname2
- the name of the second argumenttype2
- the type of the second argument- Throws:
IllegalArgumentException
- ifnode
is incomplete or not strongly typed (i.e.,node.isValid()
returnsfalse
)
-
Lambda
Constructs a new node for defining an immutable, anonymous function with a user-defined number of arguments.- Parameters:
node
- the body of this functionvariableNames
- the names of the arguments to this functionvariableTypes
- the types of the arguments to this function- Throws:
IllegalArgumentException
- ifnode
is incomplete or not strongly typed (i.e.,node.isValid()
returnsfalse
)
-
-
Method Details