本文整理汇总了Java中jason.asSemantics.Unifier.bind方法的典型用法代码示例。如果您正苦于以下问题:Java Unifier.bind方法的具体用法?Java Unifier.bind怎么用?Java Unifier.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jason.asSemantics.Unifier
的用法示例。
在下文中一共展示了Unifier.bind方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasVar
import jason.asSemantics.Unifier; //导入方法依赖的package包/类
@Override
public boolean hasVar(VarTerm t, Unifier u) {
if (equals(t))
return true;
if (u != null) { // if the var has a value in the unifier, search in that value
Term vl = u.get(this);
if (vl != null) {
try {
u.remove(this); // remove this var from the unifier to avoid going to search inside it again
return vl.hasVar(t, u);
} finally {
u.bind(this, vl);
}
}
}
return false;
}
示例2: capply
import jason.asSemantics.Unifier; //导入方法依赖的package包/类
@Override
public Term capply(Unifier u) {
Term v = u.remove(cyclicVar);
Term r = new CyclicTerm(this, (VarTerm)cyclicVar.clone(), u);
if (v != null)
u.bind(cyclicVar, v);
return r;
}
示例3: capply
import jason.asSemantics.Unifier; //导入方法依赖的package包/类
@Override
public Term capply(Unifier u) {
if (u != null) {
Term vl = u.get(this);
if (vl != null) {
if (!vl.isCyclicTerm() && vl.hasVar(this, u)) {
//logger.warning("The value of a variable contains itself, variable "+super.getFunctor()+" "+super.getSrcInfo()+", value="+vl+", unifier="+u);
u.remove(this); // remove this var to avoid loops in the apply below
Term tempVl = vl.capply(u);
u.bind(this, vl);
CyclicTerm ct = new CyclicTerm((Literal)tempVl, this);
Unifier renamedVars = new Unifier(); // remove "this" from the value to avoid loops in apply
ct.makeVarsAnnon(renamedVars);
renamedVars.remove(this);
u.compose(renamedVars);
vl = ct;
}
vl = vl.capply(u); // should clone here, since there is no cloning in unify
if (vl.isLiteral()) {
if (getNS() != Literal.DefaultNS) {
// TODO: change capply to has the new namespace as parameter and them remove this code
// use var ns for the value ns
vl = ((Literal)vl).cloneNS( (Atom)getNS().capply(u) ); // this var ns could be a var, so capply
}
if (negated()) {
((Literal)vl).setNegated(Literal.LNeg);
}
}
// decide whether to use var annots in apply
// X = p[a]
// !X[b]
// what's the event:
// +!p[a]
// or
// +!p[a,b]
// Answer: use annots of var, useful for meta-programming like
// P[step(N)]
if (vl.isLiteral() && this.hasAnnot()) { // if this var has annots, add them in the value's annots (Experimental)
vl = ((Literal)vl).forceFullLiteralImpl().addAnnots((ListTerm)this.getAnnots().capply(u));
}
return vl;
}
}
return clone();
}