Class Unifier

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

public class Unifier
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Iterable<VarTerm>, java.io.Serializable, ToDOM
See Also:
Serialized Form
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
      Constant Field Values
    • logger

      private static java.util.logging.Logger logger
    • function

      protected java.util.Map<VarTerm,​Term> function
  • Constructor Details

    • Unifier

      public Unifier()
  • Method Details

    • get

      public Term get​(java.lang.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 java.util.Iterator<VarTerm> iterator()
      Specified by:
      iterator in interface java.lang.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 = {}
    • cloneFunction

      private java.util.Map<VarTerm,​Term> cloneFunction()
    • 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)
    • unifiesNamespace

      private boolean unifiesNamespace​(Literal t1s, Literal t2s)
    • deref

      public VarTerm deref​(VarTerm v)
    • bind

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

      public boolean bind​(VarTerm vt, Term vl)
    • getVarForUnifier

      private VarTerm getVarForUnifier​(VarTerm v)
    • clear

      public void clear()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.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 java.lang.Object
    • hashCode

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

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • getAsDOM

      public org.w3c.dom.Element getAsDOM​(org.w3c.dom.Document document)
      get as XML
      Specified by:
      getAsDOM in interface ToDOM
    • setMap

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