Enum Class BoolOp

java.lang.Object
java.lang.Enum<BoolOp>
io.jenetics.prog.op.BoolOp
All Implemented Interfaces:
Op<Boolean>, Serializable, Comparable<BoolOp>, Constable, Function<Boolean[],Boolean>, Supplier<Op<Boolean>>

public enum BoolOp extends Enum<BoolOp> implements Op<Boolean>
This class contains basic and secondary boolean operations.
Since:
5.0
Version:
5.0
  • Enum Constant Details

    • AND

      public static final BoolOp AND
      Conjunction. This operation has arity 2.
    • OR

      public static final BoolOp OR
      Disjunction. This operation has arity 2.
    • NOT

      public static final BoolOp NOT
      Negation. This operation has arity 1.
    • IMP

      public static final BoolOp IMP
      Implication. This operation has arity 2.
    • XOR

      public static final BoolOp XOR
      Exclusive or. This operation has arity 2.
    • EQU

      public static final BoolOp EQU
      Equivalence. This operation has arity 2.
  • Field Details

  • Method Details

    • values

      public static BoolOp[] 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

      public static BoolOp valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • arity

      public int arity()
      Description copied from interface: Op
      Return the arity of the operation function. If the arity is zero, the operation is terminal operation.
      Specified by:
      arity in interface Op<Boolean>
      Returns:
      the arity of the operation
    • apply

      public Boolean apply(Boolean[] args)
      Specified by:
      apply in interface Function<Boolean[],Boolean>
    • eval

      public boolean eval(boolean... args)
      Evaluates the operation with the given arguments.
      Parameters:
      args - the operation arguments
      Returns:
      the evaluated operation
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Enum<BoolOp>
    • toBoolOp

      public static Op<Boolean> toBoolOp(String string)
      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 given value doesn't represent a mathematical expression
      NullPointerException - if the given string value is null
      Since:
      5.0
      See Also: