Enum Class BoolOp
- All Implemented Interfaces:
Op<Boolean>, Serializable, Comparable<BoolOp>, Constable, Function<Boolean[], Boolean>, Supplier<Op<Boolean>>
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintarity()Return the arity of the operation function.booleaneval(boolean... args) Evaluates the operation with the given arguments.Converts the string representation of an operation to the operation object.toString()static BoolOpReturns 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 Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfMethods inherited from interface Op
get, isTerminal, name
-
Enum Constant Details
-
AND
-
OR
-
NOT
-
IMP
-
XOR
-
EQU
-
-
Field Details
-
TRUE
-
FALSE
-
-
Method Details
-
values
-
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
-
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 givenvaluedoesn't represent a mathematical expressionNullPointerException- if the given stringvalueisnull- Since:
- 5.0
- See Also:
-