@PlanAborted @PlanFailed public void failure(Exception e) { // goal.getDisaster().setProperty("active", false); // System.out.println("aborted: "+this+" "+goal.getDisaster()); // e.printStackTrace(); } }
@Goal public class AGoal { @GoalResult protected String result; }
@Agent @Goals(@Goal(clazz=StampGoal.class, publish=@Publish(type=IStampService.class))) public class StampBDI { @Plan(trigger=@Trigger(goals=StampGoal.class)) public void stamp(IComponentIdentifier wp, String text) { // transport work piece to stamp and stamp with text System.out.println("Stamped workpiece: "+wp+" with text: "+text); } }
/** * Create a new HandleDisaster. */ @GoalCreationCondition(rawevents=@RawEvent(value=ChangeEvent.FACTADDED, second="disasters")) public HandleDisaster(ISpaceObject disaster) { this.disaster = disaster; }
@Goal public class StampGoal { @GoalParameter protected IComponentIdentifier wp; @GoalParameter protected String text; public StampGoal(IComponentIdentifier wp, String text) { this.wp = wp; this.text = text; } }
/** * Get the value. */ @Belief public String getValue() { return val; }
/** * Create a new goal whenever sayhello belief is changed. */ @GoalCreationCondition(beliefs="sayhello") // public HelloGoal(@Event("sayhello") String text) public HelloGoal(String text) { this.text = text; }
/** * Drop condition. * @return True if should be dropped. */ @GoalDropCondition(beliefs="missionend") public boolean checkDrop() { return missionend; } }
/** * Goal for running around on the grid and searching for garbage. */ @Goal(excludemode=ExcludeMode.Never, orsuccess=false) public class Check { }
/** * Called when a plan fails. */ @PlanFailed @PlanAborted public void failed(Exception e) { // System.out.println("Plan failed for: "+goal+" "+e); // e.printStackTrace(); } }
/** * Set the time. * @param time The time to set. */ @Belief public void setTime(long time) { this.time = time; } }
/** * Called when a plan fails. */ @PlanFailed @PlanAborted public void failed(Exception e) { // System.out.println("Plan failed: "+this); // e.printStackTrace(); } }
/** * Set the time. * @param time The time to set. */ @Belief public void setTime(long time) { this.time = time; } }
@PlanAborted @PlanFailed public void aborted(Exception e) { // System.out.println("aborted: "+e+" "+this); // e.printStackTrace(); }
/** * Set the wordtable. */ @Belief public native void setWordtable(Map<String, String> wordtable); }