Enum Class Proposition.Operator

java.lang.Object
java.lang.Enum<Proposition.Operator>
edu.uky.cs.nil.tt.world.Proposition.Operator
All Implemented Interfaces:
Serializable, Comparable<Proposition.Operator>, Constable
Enclosing class:
Proposition

public static enum Proposition.Operator extends Enum<Proposition.Operator>
An operator defines the behavior of a proposition.
Author:
Stephen G. Ware
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    An operator that is true just when all of its arguments are true (and is true if it has no arguments)
    An operator that requires at least 1 argument and is true just when all of its arguments are the same
    An operator that requires exactly 1 argument and is true just when its argument is false and false just when its argument is true
    An operator that is true just when one of its arguments is true (and is false if it has no arguments)
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract Value
    evaluate(Expression[] arguments, State state)
    Evaluates the truth value of a proposition whose operator is this operator and whose arguments are the given arguments in a given state.
     
    protected void
    validate(Expression[] arguments)
    Checks whether this operator can be applied to the given arguments.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • EQUALS

      public static final Proposition.Operator EQUALS
      An operator that requires at least 1 argument and is true just when all of its arguments are the same
    • NOT

      public static final Proposition.Operator NOT
      An operator that requires exactly 1 argument and is true just when its argument is false and false just when its argument is true
    • AND

      public static final Proposition.Operator AND
      An operator that is true just when all of its arguments are true (and is true if it has no arguments)
    • OR

      public static final Proposition.Operator OR
      An operator that is true just when one of its arguments is true (and is false if it has no arguments)
  • Method Details

    • values

      public static Proposition.Operator[] 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 Proposition.Operator 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
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Proposition.Operator>
    • validate

      protected void validate(Expression[] arguments)
      Checks whether this operator can be applied to the given arguments. Some operators require a certain number or type of arguments. This method is used to check whether a proposition is valid according to those rules. This method should throw an exception if this operator cannot be applied to the given arguments.
      Parameters:
      arguments - the potential arguments this operator may be applied to
      Throws:
      IllegalArgumentException - if the arguments do not meet the requirements of this operator
    • evaluate

      protected abstract Value evaluate(Expression[] arguments, State state)
      Evaluates the truth value of a proposition whose operator is this operator and whose arguments are the given arguments in a given state.
      Parameters:
      arguments - the proposition's arguments
      state - the state in which the proposition is evaluated
      Returns:
      the value of the proposition (true or false)