Class Mapping.Predicate

java.lang.Object
edu.uky.cs.nil.sabre.Mapping.Predicate
All Implemented Interfaces:
Logical, Simplifiable, Typed, Mapping<Disjunction<Clause<Precondition>>>, Serializable, Comparable<Logical>
Enclosing interface:
Mapping<E extends Expression>

public static class Mapping.Predicate extends Object implements Mapping<Disjunction<Clause<Precondition>>>
A mapping which returns true for a defined list of characters and false for all others.
Author:
Stephen G. Ware
See Also:
  • Constructor Details

    • Predicate

      public Predicate(ImmutableSet<Character> characters)
      Constructs a new predicate.
      Parameters:
      characters - the characters for which this mapping should return true
    • Predicate

      public Predicate(Character... characters)
      Constructs a new predicate.
      Parameters:
      characters - the characters for which this mapping should return true
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Logical other)
      Specified by:
      compareTo in interface Comparable<Logical>
      Specified by:
      compareTo in interface Logical
    • isGround

      public boolean isGround()
      Description copied from interface: Logical
      Tests whether this logical formula is ground, which means that it contains no variables.
      Specified by:
      isGround in interface Logical
      Returns:
      true if this formula contains no variables, false otherwise
    • apply

      public Mapping.Predicate apply(Function<Object,Object> function)
      Description copied from interface: Logical
      Applies a given function to every part of this logical formula and then creates a new logical formula of this same type using the results returned from the function. If, for every part of this formula, the function always returns its input as output with no changes, this method should return this object (not just any object that is equal to this object).
      Specified by:
      apply in interface Logical
      Specified by:
      apply in interface Mapping<Disjunction<Clause<Precondition>>>
      Specified by:
      apply in interface Simplifiable
      Parameters:
      function - the function to apply to all parts of this formula
      Returns:
      a logical formula of the same type as this formula made from the returned objects, or this object if no parts were changed by the function
    • isBoolean

      public boolean isBoolean()
      Description copied from interface: Typed
      Tests whether this formula is of type boolean.
      Specified by:
      isBoolean in interface Typed
      Returns:
      true if the formula is Boolean, false otherwise
    • isNumber

      public boolean isNumber()
      Description copied from interface: Typed
      Tests whether this formula is of type number.
      Specified by:
      isNumber in interface Typed
      Returns:
      true if the formula is numeric, false otherwise
    • isEntity

      public boolean isEntity()
      Description copied from interface: Typed
      Tests whether this formula is of type entity.
      Specified by:
      isEntity in interface Typed
      Returns:
      true if the formula is of type entity, false otherwise
    • isCharacter

      public boolean isCharacter()
      Description copied from interface: Typed
      Tests whether this formula is of type character.
      Specified by:
      isCharacter in interface Typed
      Returns:
      true if the formula is of type character, false otherwise
    • is

      public boolean is(Type type)
      Description copied from interface: Typed
      Tests whether this formula is of a given type.
      Specified by:
      is in interface Typed
      Parameters:
      type - the type being tested
      Returns:
      true if the formula is of this type or one of its subtypes, false otherwise
    • get

      public Disjunction<Clause<Precondition>> get(Parameter character)
      Description copied from interface: Mapping
      Returns an expression relevant to the given character.
      Specified by:
      get in interface Mapping<Disjunction<Clause<Precondition>>>
      Parameters:
      character - the character
      Returns:
      the expression
    • cast

      public <T extends Expression> Mapping<T> cast(Class<T> type)
      Description copied from interface: Mapping
      Casts the type of expression returned by this mapping to a different type.
      Specified by:
      cast in interface Mapping<Disjunction<Clause<Precondition>>>
      Type Parameters:
      T - the new type of expression this mapping should return
      Parameters:
      type - the class object for the new type
      Returns:
      a mapping that returns expressions of the new type