Exemplo n.º 1
0
  /**
   * Executes this action.
   *
   * @param module the module to execute this action for.
   * @return true if the action succeeds, false otherwise.
   */
  public PlanResult execute(APLModule module) {
    Beliefbase beliefs = module.getBeliefbase();
    PCrulebase pcrules = module.getPCrulebase();
    plan.evaluateArguments();

    SubstList<Term> theta = new SubstList<Term>();

    PCrule rule;
    try {
      rule = pcrules.selectRule(beliefs, plan, getTopParent().getVariables(), theta, module);
    } catch (NoRuleException e) {
      return new PlanResult(this, PlanResult.FAILED);
    }

    if (rule != null) {
      PlanSeq p = rule.getBody().clone();
      p.applySubstitution(theta);

      parent.removeFirst();
      parent.addFirst(p);
      return new PlanResult(this, PlanResult.SUCCEEDED);
    } else return new PlanResult(this, PlanResult.FAILED);
  }
Exemplo n.º 2
0
 public void checkPlan(LinkedList<String> warnings, APLModule module) {
   if (!module.getPCrulebase().defines(this))
     // warnings.add("Abstract action \""+this+"\" has no corresponding PC rule.");
     warnings.add("Abstract action \"" + toRTF(0) + "\"  has no corresponding PC rule.");
 }
Exemplo n.º 3
0
 public PlanResult execute(APLModule module) {
   System.out.println("[" + module.getLocalName() + "] " + pt);
   parent.removeFirst();
   return new PlanResult(this, PlanResult.SUCCEEDED);
 }