@Goal public class AchieveSuccess { @GoalTargetCondition//(beliefs="success") public boolean achieved() { return success; } } }
/** * Goal for running around on the grid and searching for garbage. */ @Goal(excludemode=ExcludeMode.Never, orsuccess=false) public class Check { }
/** The top-level goal to come to the university. */ @Goal protected class ComeToUniGoal { }
/** * The goal for picking up waste. Tries endlessly to pick up. */ @Goal(excludemode=ExcludeMode.Never, retrydelay=100) public class Pick { }
/** * A test goal. */ @Goal(rebuild=true) public class SomeGoal { public List<String> plans = new ArrayList<String>(); }
@Goal public class BecomeRich { @GoalTargetCondition//(beliefs="money") public boolean checkTarget() { return money==target; } }
@Goal public class TestGoal { }
@Goal public class GetVisionAction { protected Vision vision; public Vision getVision() { return vision; } public void setVision(Vision vision) { this.vision = vision; } }
@Goal(excludemode=ExcludeMode.Never, orsuccess=false, retrydelay=300) public class PerformMemorizePositions { }
@Goal(recur=true, recurdelay=1000) public class GetOneEuro { }
@Goal(recur=true) public class Cnt1Goal { @GoalTargetCondition//(beliefs="num1") protected boolean checkTarget() { return num1==2; } }
@Goal(recur=true) public class Cnt2Goal { @GoalTargetCondition//(beliefs="num2") protected boolean checkTarget() { return num2==3; } }
/** * Goal that lets the cleaner look for waste. */ @Goal(excludemode=ExcludeMode.Never, orsuccess=false) public class PerformLookForWaste { /** * Suspend the goal at night. */ @GoalContextCondition//(beliefs="daytime") public boolean checkContext() { return daytime; } }
@Goal protected class MyGoal { }
@Goal public class PickupWasteAction { protected Waste waste; public PickupWasteAction(Waste waste) { this.waste = waste; } public Waste getWaste() { return waste; } }
@Goal public class AGoal { @GoalResult protected String result; }
@Goal(publish=@Publish(type=IPaintMoneyService.class)) public class GetOneEuro { public GetOneEuro(String from) { // System.out.println("created goal: "+this); // Thread.dumpStack(); // System.out.println("created painter goal: "+from); } }
@Goal public class StampGoal { @GoalParameter protected IComponentIdentifier wp; @GoalParameter protected String text; public StampGoal(IComponentIdentifier wp, String text) { this.wp = wp; this.text = text; } }
@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); } }
@Agent @Goals(@Goal(clazz=StampGoal.class)) @RequiredServices(@RequiredService(name="stampser", type=IStampService.class, binding=@Binding(scope=RequiredServiceInfo.SCOPE_PLATFORM))) @Plans(@Plan(trigger=@Trigger(goals=StampGoal.class), body=@Body(service=@ServicePlan(name="stampser")))) public class WorkpieceBDI { @AgentBody public void body(IInternalAccess agent) { agent.getComponentFeature(IBDIAgentFeature.class).dispatchTopLevelGoal(new StampGoal(agent.getComponentIdentifier(), "date: "+System.currentTimeMillis())).get(); } }