Class Term

java.lang.Object
edu.uky.ai.logic.Term
All Implemented Interfaces:
Formula, Comparable<Formula>
Direct Known Subclasses:
Constant, Variable

public abstract class Term extends Object implements Formula
A term is a reference to an individual thing in the world, and does not have a truth value. Terms have types, which define groups of similar things. Two terms are considered to refer to the same thing (i.e. are equals(Object)) if they have the same type and same name.
Author:
Stephen G. Ware
  • Field Details

    • DEFAULT_TYPE

      public static final String DEFAULT_TYPE
      The default type. All terms are considered to be of this type.
      See Also:
    • type

      public final String type
      The term's type. All terms are of the DEFAULT_TYPE and may also be of one additional type as defined by this string.
    • name

      public final String name
      The thing's name
  • Constructor Details

    • Term

      public Term(String type, String name)
      Constructs a term from the given type and name.
      Parameters:
      type - the term's type
      name - the term's name
  • 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
    • substitute

      public Term substitute(Substitution substitution)
      Description copied from interface: Formula
      Returns a version of this formula such that any elements that appear in the given substitution are replaced.
      Specified by:
      substitute in interface Formula
      Parameters:
      substitution - the substitution
      Returns:
      a formula with replacements from the substitution
    • unify

      public Bindings unify(Formula other, Bindings bindings)
      Description copied from interface: Formula
      Finds the bindings that would be necessary to make this formula the same as another formula (if any exist).
      Specified by:
      unify in interface Formula
      Parameters:
      other - the other formula
      bindings - an existing set of bindings that will be added to
      Returns:
      the bindings that would make both formulas the same, or null if so such bindings exist