Class Unifier

java.lang.Object
jason.asSemantics.Unifier
All Implemented Interfaces:
ToDOM, Serializable, Cloneable, Iterable<VarTerm>

public class Unifier extends Object implements Cloneable, Iterable<VarTerm>, Serializable, ToDOM
See Also:
  • Field Details

  • Constructor Details

    • Unifier

      public Unifier()
  • Method Details

    • get

      public Term get(String var)
      gets the value for a Var, if it is unified with another var, gets this other's value
    • remove

      public Term remove(VarTerm v)
    • iterator

      public Iterator<VarTerm> iterator()
      Specified by:
      iterator in interface Iterable<VarTerm>
    • get

      public Term get(VarTerm vtp)
      gets the value for a Var, if it is unified with another var, gets this other's value
    • getVarFromValue

      public VarTerm getVarFromValue(Term vl)
    • unifies

      public boolean unifies(Trigger te1, Trigger te2)
    • unifiesNoUndo

      public boolean unifiesNoUndo(Trigger te1, Trigger te2)
    • unifies

      public boolean unifies(Term t1, Term t2)
      this version of unifies undo the variables' mapping if the unification fails. E.g. u.unifier( a(X,10), a(1,1) ); does not change u, i.e., u = {}
    • unifiesNoUndo

      public boolean unifiesNoUndo(Term t1g, Term t2g)
      this version of unifies does not undo the variables' mapping in case of failure. It is however faster than the version with undo. E.g. u.unifier( a(X,10), a(1,1) ); fails, but changes u to {X = 10}
    • unifyTerms

      protected boolean unifyTerms(Term t1g, Term t2g)
    • deref

      public VarTerm deref(VarTerm v)
    • bind

      public void bind(VarTerm vt1, VarTerm vt2)
    • bind

      public boolean bind(VarTerm vt, Term vl)
    • clear

      public void clear()
    • toString

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

      public Term getAsTerm()
    • size

      public int size()
    • compose

      public void compose(Unifier u)
      add all unifications from u
    • clone

      public Unifier clone()
      Overrides:
      clone in class Object
    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getAsDOM

      public Element getAsDOM(Document document)
      get as XML
      Specified by:
      getAsDOM in interface ToDOM
    • setMap

      public void setMap(Map<VarTerm,Term> newFunc)
      changes the implementation of Var/Value mapping -- should be used carefully