- All Implemented Interfaces:
Op<Boolean>
,Serializable
,Comparable<BoolOp>
,Constable
,Function<Boolean[],
,Boolean> Supplier<Op<Boolean>>
This class contains basic and secondary boolean operations.
- Since:
- 5.0
- Version:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
arity()
Return the arity of the operation function.boolean
eval
(boolean... args) Evaluates the operation with the given arguments.Converts the string representation of an operation to the operation object.toString()
static BoolOp
Returns the enum constant of this class with the specified name.static BoolOp[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
Methods inherited from interface io.jenetics.prog.op.Op
get, isTerminal, name
-
Enum Constant Details
-
AND
Conjunction. This operation has arity 2. -
OR
Disjunction. This operation has arity 2. -
NOT
Negation. This operation has arity 1. -
IMP
Implication. This operation has arity 2. -
XOR
Exclusive or. This operation has arity 2. -
EQU
Equivalence. This operation has arity 2.
-
-
Field Details
-
TRUE
Represents the constanttrue
. -
FALSE
Represents the constanttrue
.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
arity
Description copied from interface:Op
Return the arity of the operation function. If the arity is zero, the operation is terminal operation. -
apply
-
eval
Evaluates the operation with the given arguments.- Parameters:
args
- the operation arguments- Returns:
- the evaluated operation
- See Also:
-
toString
-
toBoolOp
Converts the string representation of an operation to the operation object. It is used for converting the string representation of a tree to an operation tree. If you use it that way, you should not forget to re-index the tree variables.final TreeNode<Op<Boolean>> tree = TreeNode.parse( "and(or(x,y),not(y))", BoolOp::toBoolOp ); assert Program.eval(tree, false, false) == false; Var.reindex(tree); assert Program.eval(tree, false, false) == true;
- Parameters:
string
- the string representation of an operation which should be converted- Returns:
- the operation, converted from the given string
- Throws:
IllegalArgumentException
- if the givenvalue
doesn't represent a mathematical expressionNullPointerException
- if the given stringvalue
isnull
- Since:
- 5.0
- See Also:
-