本文整理汇总了Java中jason.asSyntax.Literal.hasSource方法的典型用法代码示例。如果您正苦于以下问题:Java Literal.hasSource方法的具体用法?Java Literal.hasSource怎么用?Java Literal.hasSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jason.asSyntax.Literal
的用法示例。
在下文中一共展示了Literal.hasSource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInitialGoalsFromProjectInBB
import jason.asSyntax.Literal; //导入方法依赖的package包/类
protected void addInitialGoalsFromProjectInBB() {
String sGoals = getTS().getSettings().getUserParameter(Settings.INIT_GOALS);
if (sGoals != null) {
try {
for (Term t: ASSyntax.parseList("["+sGoals+"]")) {
Literal g = ((Literal)t).forceFullLiteralImpl();
g.makeVarsAnnon();
if (! g.hasSource())
g.addAnnot(BeliefBase.TSelf);
getTS().getC().addAchvGoal(g,Intention.EmptyInt);
}
} catch (Exception e) {
logger.log(Level.WARNING, "Initial goals from project '["+sGoals+"]' is not a list of literals.");
}
}
}
示例2: addInitialGoalsInTS
import jason.asSyntax.Literal; //导入方法依赖的package包/类
/** includes all initial goals in the agent reasoner */
public void addInitialGoalsInTS() {
for (Literal g: initialGoals) {
g.makeVarsAnnon();
if (! g.hasSource())
g.addAnnot(BeliefBase.TSelf);
getTS().getC().addAchvGoal(g,Intention.EmptyInt);
}
initialGoals.clear();
}
示例3: addBel
import jason.asSyntax.Literal; //导入方法依赖的package包/类
/**
* Adds <i>bel</i> in belief base (calling brf) and generates the
* events. If <i>bel</i> has no source, add
* <code>source(self)</code>. (the belief is not cloned!)
*/
public boolean addBel(Literal bel) throws RevisionFailedException {
if (!bel.hasSource()) {
bel.addAnnot(BeliefBase.TSelf);
}
List<Literal>[] result = brf(bel, null, Intention.EmptyInt);
if (result != null && ts != null) {
ts.updateEvents(result, Intention.EmptyInt);
return true;
} else {
return false;
}
}
示例4: delBel
import jason.asSyntax.Literal; //导入方法依赖的package包/类
/**
* If the agent believes in <i>bel</i>, removes it (calling brf)
* and generate the event.
*/
public boolean delBel(Literal bel) throws RevisionFailedException {
if (!bel.hasSource()) {
bel.addAnnot(BeliefBase.TSelf);
}
List<Literal>[] result = brf(null, bel, Intention.EmptyInt);
if (result != null && ts != null) {
ts.updateEvents(result, Intention.EmptyInt);
return true;
} else {
return false;
}
}
示例5: removeFromEntry
import jason.asSyntax.Literal; //导入方法依赖的package包/类
private boolean removeFromEntry(Literal l) {
if (l.hasSource()) {
return false;
} else {
Map<PredicateIndicator, BelEntry> belsMap = l.getNS() == Literal.DefaultNS ? belsMapDefaultNS : nameSpaces.get(l.getNS());
PredicateIndicator key = l.getPredicateIndicator();
BelEntry entry = belsMap.get(key);
entry.remove(l);
if (entry.isEmpty()) {
belsMap.remove(key);
}
size--;
return true;
}
}