public enum BoolOp extends Enum<BoolOp> implements Op<Boolean>
| Enum Constant and Description |
|---|
AND
Conjunction.
|
EQU
Equivalence.
|
IMP
Implication.
|
NOT
Negation.
|
OR
Disjunction.
|
XOR
Exclusive or.
|
| Modifier and Type | Field and Description |
|---|---|
static Const<Boolean> |
FALSE
Represents the constant
true. |
static Const<Boolean> |
TRUE
Represents the constant
true. |
| Modifier and Type | Method and Description |
|---|---|
Boolean |
apply(Boolean[] args) |
int |
arity()
Return the arity of the operation function.
|
boolean |
eval(boolean... args)
Evaluates the operation with the given arguments.
|
static Op<Boolean> |
toBoolOp(String string)
Converts the string representation of an operation to the operation
object.
|
String |
toString() |
static BoolOp |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static BoolOp[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static BoolOp[] values()
for (BoolOp c : BoolOp.values()) System.out.println(c);
public static BoolOp valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic int arity()
Oppublic boolean eval(boolean... args)
args - the operation argumentsapply(Boolean[])public static Op<Boolean> toBoolOp(String string)
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;string - the string representation of an operation which should be
convertedIllegalArgumentException - if the given value doesn't
represent a mathematical expressionNullPointerException - if the given string value is
nullVar.reindex(TreeNode),
Program.eval(Tree, Object[])© 2007-2019 Franz Wilhelmstötter (2019-11-18 20:30)