Package jason.asSemantics
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 Summary
Fields Modifier and Type Field Description protected java.util.Map<VarTerm,Term>
function
private static java.util.logging.Logger
logger
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description Unifier()
-
Method Summary
Modifier and Type Method Description boolean
bind(VarTerm vt, Term vl)
void
bind(VarTerm vt1, VarTerm vt2)
void
clear()
Unifier
clone()
private java.util.Map<VarTerm,Term>
cloneFunction()
void
compose(Unifier u)
add all unifications from uVarTerm
deref(VarTerm v)
boolean
equals(java.lang.Object o)
Term
get(VarTerm vtp)
gets the value for a Var, if it is unified with another var, gets this other's valueTerm
get(java.lang.String var)
gets the value for a Var, if it is unified with another var, gets this other's valueorg.w3c.dom.Element
getAsDOM(org.w3c.dom.Document document)
get as XMLTerm
getAsTerm()
private VarTerm
getVarForUnifier(VarTerm v)
VarTerm
getVarFromValue(Term vl)
int
hashCode()
java.util.Iterator<VarTerm>
iterator()
Term
remove(VarTerm v)
void
setMap(java.util.Map<VarTerm,Term> newFunc)
changes the implementation of Var/Value mapping -- should be used carefullyint
size()
java.lang.String
toString()
boolean
unifies(Term t1, Term t2)
this version of unifies undo the variables' mapping if the unification fails.boolean
unifies(Trigger te1, Trigger te2)
private boolean
unifiesNamespace(Literal t1s, Literal t2s)
boolean
unifiesNoUndo(Term t1g, Term t2g)
this version of unifies does not undo the variables' mapping in case of failure.boolean
unifiesNoUndo(Trigger te1, Trigger te2)
protected boolean
unifyTerms(Term t1g, Term t2g)
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
- Constant Field Values
-
logger
private static java.util.logging.Logger logger -
function
-
-
Constructor Details
-
Unifier
public Unifier()
-
-
Method Details
-
get
gets the value for a Var, if it is unified with another var, gets this other's value -
remove
-
iterator
- Specified by:
iterator
in interfacejava.lang.Iterable<VarTerm>
-
get
gets the value for a Var, if it is unified with another var, gets this other's value -
getVarFromValue
-
unifies
-
unifiesNoUndo
-
unifies
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
-
unifiesNoUndo
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
-
unifiesNamespace
-
deref
-
bind
-
bind
-
getVarForUnifier
-
clear
public void clear() -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getAsTerm
-
size
public int size() -
compose
add all unifications from u -
clone
- Overrides:
clone
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
getAsDOM
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)get as XML -
setMap
changes the implementation of Var/Value mapping -- should be used carefully
-