@Override public Term applySubst(Substitution s) { Term value = (s == null) ? null : s.get(this); return (value == null) ? this : value; }
/** * * @param content */ public void setContent(Update content) { this.content = content; this.free = this.content.getFreeVar(); }
/** * A message is considered to be closed if its content is closed, or if it is an * interrogative (and variables are allowed in the message content). * * @return {@code true} if the content of the message does not have any free * variables, or the message is an interrogative; {@code false} * otherwise. */ public boolean isClosed() { return this.content.isClosed() || this.mood == SentenceMood.INTERROGATIVE; }
/** * See {@link #update(List, List)}. Deleting an {@link Update} is calling * update with the add and delete lists reversed. * * @param update * The update to be processed. * @throws MSTQueryException */ public Result delete(Update update) throws MSTQueryException { return update(update.getDeleteList(), update.getAddList()); }
public ActionPreCondition applySubst(Substitution subst) { return new ActionPreCondition((getPreCondition() == null) ? null : getPreCondition().applySubst(subst), getSignatures(), getSourceInfo()); }
@Override public SleepAction applySubst(Substitution substitution) { return new SleepAction((getParameters() == null || getParameters().isEmpty()) ? null : getParameters().get(0).applySubst(substitution), getSourceInfo()); } }
public boolean isClosed() { return this.query.isClosed(); }
public ActionPostCondition applySubst(Substitution subst) { return new ActionPostCondition((getPostCondition() == null) ? null : getPostCondition().applySubst(subst), isNegative(), getSourceInfo()); }
/** * Adds a parameter of the action. * * @param parameter * The parameter to be added. */ public void addParameter(Parameter parameter) { this.parameters.add(parameter); this.free.addAll(parameter.getFreeVar()); }
/** * See {@link #update(List, List)}. * * @param update * The update to be processed. * @throws MSTQueryException */ public Result insert(Update update) throws MSTQueryException { return update(update.getAddList(), update.getDeleteList()); }
@Override public MentalLiteral applySubst(Substitution substitution) { return new PerceptLiteral(isPositive(), (getSelector() == null) ? null : getSelector().applySubst(substitution), (getFormula() == null) ? null : getFormula().applySubst(substitution), getUsedSignatures(), getSourceInfo()); }
@Override public PrologCompoundImpl applySubst(Substitution s) { Term[] instantiatedArgs = new Term[getArity()]; // Recursively apply the substitution to all sub-terms. for (int i = 0; i < getArity(); ++i) { instantiatedArgs[i] = getArg(i).applySubst(s); } return new PrologCompoundImpl(getName(), instantiatedArgs, this.info); }
/** * Applies a substitution to the content of this message. * * @param substitution * Substitution for instantiating (free) variables in the message * content. * @return A message with content instantiated by applying the substitution. */ public Message applySubst(Substitution substitution) { return new Message(getSender(), getReceivers(), (getContent() == null) ? null : getContent().applySubst(substitution), getMood()); }
/** * Check that no beliefs are inserted/deleted that are already knowledge * * @param knowledgeDefined * @param knowledgeDeclared * @param beliefUpdates * all belief updates, both from inserts, deletes, and actionspecs. * @throws ParserException */ private void checkNoBeliefsInsertedAsKnowledge(Map<String, SourceInfo> knowledgeDefined, Map<String, SourceInfo> knowledgeDeclared, Set<Update> beliefUpdates) { for (Update update : beliefUpdates) { checkNoPredicatesBeliefAndKnowledge(knowledgeDefined, knowledgeDeclared, update.getAddList()); checkNoPredicatesBeliefAndKnowledge(knowledgeDefined, knowledgeDeclared, update.getDeleteList()); } }
@Override public MentalLiteral applySubst(Substitution substitution) { return new BelLiteral(isPositive(), (getSelector() == null) ? null : getSelector().applySubst(substitution), (getFormula() == null) ? null : getFormula().applySubst(substitution), getUsedSignatures(), getSourceInfo()); }
@Override public InsertAction applySubst(Substitution substitution) { return new InsertAction((getSelector() == null) ? null : getSelector().applySubst(substitution), (getUpdate() == null) ? null : getUpdate().applySubst(substitution), getSourceInfo()); } }
@Override public MentalLiteral applySubst(Substitution substitution) { return new GoalALiteral(isPositive(), (getSelector() == null) ? null : getSelector().applySubst(substitution), (getFormula() == null) ? null : getFormula().applySubst(substitution), getUsedSignatures(), getSourceInfo()); }
@Override public AdoptAction applySubst(Substitution substitution) { return new AdoptAction((getSelector() == null) ? null : getSelector().applySubst(substitution), (getUpdate() == null) ? null : getUpdate().applySubst(substitution), getSourceInfo()); } }
@Override public MentalLiteral applySubst(Substitution substitution) { return new AGoalLiteral(isPositive(), (getSelector() == null) ? null : getSelector().applySubst(substitution), (getFormula() == null) ? null : getFormula().applySubst(substitution), getUsedSignatures(), getSourceInfo()); }
@Override public MentalLiteral applySubst(Substitution substitution) { return new SentLiteral(isPositive(), (getSelector() == null) ? null : getSelector().applySubst(substitution), (getFormula() == null) ? null : getFormula().applySubst(substitution), getMood(), getUsedSignatures(), getSourceInfo()); } }