/** * Plan that prints the time. */ @Plan(trigger=@Trigger(factchangeds="time")) protected void printTime() { System.out.println(formatter.format(time)); }
/** * Translate a word. Plan that translates. */ @Plan(trigger=@Trigger(goals=Translate.class)) protected String translateB(String eword) { System.out.println("Plan B"); return wordtable.get(eword); } }
/** * Plan reacts to the automatically created * translation goal. * @param tg The translation goal. */ @Plan(trigger=@Trigger(goals=TranslationGoal.class)) public String translatePlan(String eword) { return wordtable.get(eword); }
/** * Inline plan method that reacts on count goal. */ @Plan(trigger=@Trigger(goals=CountGoal.class)) protected IFuture<Void> inc(CountGoal goal) { counter++; System.out.println("counter is: "+counter); return IFuture.DONE; }
/** * Translate a word. */ @Plan(trigger=@Trigger(goals=Translate.class)) protected String translate(String eword) { return wordtable.get(eword); } }
/** * */ @Plan(trigger=@Trigger(goals=ExternalPlanBDI.MyGoal.class)) public class ExternalPlan { @PlanBody public void body() { System.out.println("body"); } }
/** * Plan that prints the time. */ @Plan(trigger=@Trigger(factchangeds="time")) protected void printTime() { System.out.println(formatter.format(getTime())); }
/** * Plan that prints the time. */ @Plan(trigger=@Trigger(factchangeds="time")) protected void printTime() { System.out.println(formatter.format(getTime())); }
/** * Translate a word. */ @Plan(trigger=@Trigger(goals=Translate.class)) protected String translate(String eword) { return getWordtable().get(eword); }
@Plan(trigger=@Trigger(goals=TestGoal2.class)) public Double inc(TestGoal2 g, IPlan plan) { // g.inc(); plan.waitFor(200).get(); return new Double(Math.random()); }
/** * Plan reacting on test goal. */ @Plan(trigger=@Trigger(goals=TestGoal.class)) public IFuture<Void> testPlan(TestGoal goal) { goal.setCnt(goal.getCnt()+1); System.out.println("Capa plan: "+this); return new Future<Void>(new RuntimeException()); } }
/** * Prints out goal text and passes. */ @Plan(trigger=@Trigger(goals=HelloGoal.class)) protected IFuture<Void> printHello2(HelloGoal goal) { System.out.println("Plan body: "+goal.getText()); agent.killComponent(); return IFuture.DONE; } }
/** * First plan. Fails with exception. */ @Plan(trigger=@Trigger(goals=HelloGoal.class)) protected IFuture<Void> printHello1(HelloGoal goal) { System.out.println("1: "+goal.getText()); throw new PlanFailureException(); }
@Plan(trigger=@Trigger(factchangeds="names")) protected void printChFact(ChangeEvent event, RPlan rplan) { System.out.println("fact change: "+event.getValue()+" "+event.getSource()+" "+rplan); tr[1].setSucceeded(true); }
@Plan(trigger=@Trigger(goals=SomeGoal.class)) protected IFuture<Void> planB() { System.out.println("Plan B"); res += "B"; return new Future<Void>(new PlanFailureException()); // return IFuture.DONE; }
@Plan(trigger=@Trigger(goals=TestGoal.class)) public String p1(IPlan plan) { plan.waitFor(200).get(); return "p1"; }
@Plan(trigger = @Trigger(factchangeds = "number")) public void numberChangedPlan(ChangeEvent event) { ChangeInfo<Double> change = (ChangeInfo<Double>)event.getValue(); System.out.println("number has changed to: " + change.getValue() + " from " + change.getOldValue()); }
@Plan(trigger=@Trigger(factchangeds="names")) protected void printChFact(ChangeEvent event, RPlan rplan) { System.out.println("fact change: "+event.getValue()+" "+event.getSource()+" "+rplan); tr[1].setSucceeded(true); }
@Plan(trigger=@Trigger(goals=TestGoal.class)) public String p2(IPlan plan) { plan.waitFor(200).get(); return "p2"; }
@Plan(trigger=@Trigger(goals=TestGoal.class)) public void inc(TestGoal g, IPlan plan) { g.inc(); // plan.waitFor(200).get(); agent.getComponentFeature(IExecutionFeature.class).waitForDelay(200).get(); // System.out.println("plan end"); }