Constructor and Description |
---|
SwitchEnum(Class<? extends Enum<?>> enumClass,
Type enumType,
Type returnType)
Constructs a selection operator that returns values of the specified type.
|
Modifier and Type | Method and Description |
---|---|
Object |
evaluate(Arguments arguments,
Assignments assignments)
Returns the result of applying this operation to the specified
Arguments and Assignments . |
String |
getDisplayName()
Returns the
String value to use in the textual representation of this function. |
Signature |
getSignature()
Returns the return type and argument types associated with this function.
|
Node |
simplify(Arguments arguments)
Attempts to find a simplified alternative to applying this function to the specified arguments.
|
public SwitchEnum(Class<? extends Enum<?>> enumClass, Type enumType, Type returnType)
enumClass
- the enum to compare the first argument against in order to determine which branch to evaluateenumType
- the type associated with enumClass
returnType
- the type associated with values returned from the evaluation of this functionpublic Object evaluate(Arguments arguments, Assignments assignments)
Function
Arguments
and Assignments
.public Node simplify(Arguments arguments)
Function
Simplification can occur by replacing expressions with constant values (e.g. replacing (+ 1 1)
with 2
) or removing redundant branches
(e.g. replacing (if (< 2 3) (+ v0 v1) (* v0 v1))
with (+ v0 v1)
.
simplify
in interface Function
arguments
- the arguments to be applied to (i.e. evaluated by) this functionnull
if unable to simplify.NodeSimplifier
public Signature getSignature()
Function
getSignature
in interface Function
public String getDisplayName()
Function
String
value to use in the textual representation of this function.getDisplayName
in interface Function
OakGP Genetic Programming Framework