Class ListBindings

java.lang.Object
edu.uky.ai.logic.ListBindings
All Implemented Interfaces:
Bindings, Substitution

public class ListBindings extends Object implements Bindings
An implementation of Bindings based on a linked list. This data structure is immutable, meaning that operations which would modify it return a new object and leave the original unchanged.
Author:
Stephen G. Ware
  • Field Details

    • EMPTY

      public static final ListBindings EMPTY
      An empty set of bindings
  • Method Details

    • toString

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

      public Formula get(Formula original)
      Description copied from interface: Substitution
      Defines what a given formula should be replaced with.
      Specified by:
      get in interface Substitution
      Parameters:
      original - the formula which may be replaced
      Returns:
      the replacement formula, or the original formula if no replacement is defined
    • setEqual

      public Bindings setEqual(Term t1, Term t2)
      Description copied from interface: Bindings
      Declares that two terms must have the same value.
      Specified by:
      setEqual in interface Bindings
      Parameters:
      t1 - the first term
      t2 - the second term
      Returns:
      a set of bindings in which both terms must have the same value, or null if such a set would contain a contradiction
    • setNotEqual

      public Bindings setNotEqual(Term t1, Term t2)
      Description copied from interface: Bindings
      Declares that two terms must have different values.
      Specified by:
      setNotEqual in interface Bindings
      Parameters:
      t1 - the first term
      t2 - the second term
      Returns:
      a set of bindings in which both terms must have different values, or null if such a set would contain a contradiction