/** * The plan body. */ public void body() { Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); Vision v = env.getCompleteVision(); RequestCompleteVision rcv = (RequestCompleteVision)getParameter("action").getValue(); rcv.setVision(v); Done done = new Done(); done.setAction(rcv); getParameter("result").setValue(done); }
/** * The plan body. */ public void body() { RequestVision rv = new RequestVision((Creature)getBeliefbase().getBelief("my_self").getFact()); IGoal result = requestAction(rv); //Done done = (Done)result.getGoal().getResult(); Done done = (Done)result.getParameter("result").getValue(); getParameter("vision").setValue(((RequestVision)done.getAction()).getVision()); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSShutdownPlatform sd = (CMSShutdownPlatform)getParameter("action").getValue(); dispatchSubgoalAndWait(createGoal("cms_shutdown_platform")); getParameter("result").setValue(new Done(sd)); } }
msg.getParameter(SFipa.CONTENT).setValue(new Done(rb)); getLogger().info("sending bet to the dealer ... waiting for cardSet"); sendMessage(msg); Card[] cards = ((RequestDraw)((Done)ans.getParameter(SFipa.CONTENT).getValue()).getAction()).getCards(); me.setCards(cards); GameResult gr = ((RequestFinished)((Done)resultmsg.getParameter(SFipa.CONTENT).getValue()).getAction()).getGameresult(); if(gr.isWon())
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSResumeComponent ra = (CMSResumeComponent)getParameter("action").getValue(); IGoal rag = createGoal("cms_suspend_component"); rag.getParameter("componentidentifier").setValue(ra.getComponentIdentifier()); dispatchSubgoalAndWait(rag); getParameter("result").setValue(new Done(ra)); } }
int bet = ((RequestBet)((Done)content).getAction()).getBet(); if(bet>player.getAccount()) RequestDraw rd = (RequestDraw)content; rd.setCards(player.getCards()); Done done = new Done(rd); IMessageEvent mdone = getEventbase().createReply(answer, "inform_action_done"); mdone.getParameter(SFipa.CONTENT).setValue(done); Done done = new Done(rf); IMessageEvent result = getEventbase().createReply(answer, "inform_action_done"); result.getParameter(SFipa.CONTENT).setValue(done);
/** * The plan body. */ public void body() { RequestVision rv = (RequestVision)getParameter("action").getValue(); Cleaner cl = rv.getCleaner(); Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); Vision v = env.getVision(cl); rv.setVision(v); Done done = new Done(); done.setAction(rv); getParameter("result").setValue(done); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSSuspendComponent sa = (CMSSuspendComponent)getParameter("action").getValue(); IGoal sag = createGoal("cms_suspend_component"); sag.getParameter("componentidentifier").setValue(sa.getComponentIdentifier()); dispatchSubgoalAndWait(sag); getParameter("result").setValue(new Done(sa)); } }
/** * The plan body. */ public void body() { Cleaner cl = new Cleaner((Location)getBeliefbase().getBelief("my_location").getFact(), getComponentName(), (Waste)getBeliefbase().getBelief("carriedwaste").getFact(), ((Number)getBeliefbase().getBelief("my_vision").getFact()).doubleValue(), ((Number)getBeliefbase().getBelief("my_chargestate").getFact()).doubleValue()); RequestVision rv = new RequestVision(); rv.setCleaner(cl); IGoal result = requestAction(rv); Vision vision = ((RequestVision)(((Done)result.getParameter("result").getValue()).getAction())).getVision(); getParameter("vision").setValue(vision); } }
/** * The plan body. */ public void body() { RequestPickUpWaste op = (RequestPickUpWaste)getParameter("action").getValue(); Waste waste = op.getWaste(); Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); boolean success = env.pickUpWaste(waste); if(!success) fail(); Done done = new Done(); done.setAction(op); getParameter("result").setValue(done); }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSDestroyComponent da = (CMSDestroyComponent)getParameter("action").getValue(); IGoal dag = createGoal("cms_destroy_component"); dag.getParameter("componentidentifier").setValue(da.getComponentIdentifier()); dispatchSubgoalAndWait(dag); getParameter("result").setValue(new Done(da)); } }
/** * First the player searches a dealer, then sends a join-request to this * dealer. */ public void body() { // Search for dealer. IComponentIdentifier dealer = (IComponentIdentifier)getBeliefbase().getBelief("dealer").getFact(); Player me = (Player)getBeliefbase().getBelief("myself").getFact(); // create the join-message IMessageEvent msg = createMessageEvent("request_join"); msg.getParameterSet(SFipa.RECEIVERS).addValue(dealer); RequestJoin rj = new RequestJoin(); rj.setPlayer(me); //msg.setContent("join:" + getAgentName() + ":" + me.getStrategyName() + ":" + me.getAccount() + ":" + Player.color2Hex(me.getColor())); msg.getParameter(SFipa.CONTENT).setValue(rj); getLogger().info("sending join-message"); // send the join-message and wait for a response IMessageEvent reply = sendMessageAndWait(msg, 10000); // evaluate content of the reply-message Object content = reply.getParameter(SFipa.CONTENT).getValue(); if(content instanceof Done) { getLogger().info("request was accepted, timeout is: " + content); getBeliefbase().getBelief("timeout").setFact( Integer.valueOf(((RequestJoin)((Done)content).getAction()).getTimeout())); getBeliefbase().getBelief("dealer").setFact(dealer); } }
/** * The plan body. */ public void body() { RequestDropWaste op = (RequestDropWaste)getParameter("action").getValue(); Waste waste = op.getWaste(); String wastebinname = op.getWastebinname(); Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); Wastebin wb = env.getWastebin(wastebinname); boolean success = env.dropWasteInWastebin(waste, wb); if(!success) fail(); Done done = new Done(); done.setAction(op); getParameter("result").setValue(op); }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { DFDeregister de = (DFDeregister)getParameter("action").getValue(); IGoal dreg = createGoal("df_deregister"); dreg.getParameter("description").setValue(de.getComponentDescription()); dispatchSubgoalAndWait(dreg); getParameter("result").setValue(new Done(de)); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { DFSearch se = new DFSearch(); se.setComponentDescription((IDFComponentDescription)getParameter("description").getValue()); se.setSearchConstraints((ISearchConstraints)getParameter("constraints").getValue()); se.setRemote(getParameter("remote").getValue()!=null? ((Boolean)getParameter("remote").getValue()).booleanValue(): false); IGoal req = createGoal("rp_initiate"); req.getParameter("receiver").setValue(getParameter("df").getValue()); req.getParameter("action").setValue(se); req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME); dispatchSubgoalAndWait(req); getParameterSet("result").addValues(((DFSearch)((Done)req.getParameter("result").getValue()).getAction()).getResults()); } }
/** * The plan body. */ public void body() { // System.out.println("Env: dispatching vision!!!"); RequestVision rv = (RequestVision)getParameter("action").getValue(); Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); Vision v = env.getVision(rv.getCreature()); rv.setVision(v); Done done = new Done(); done.setAction(rv); getParameter("result").setValue(done); /*IMessageEvent req = (IMessageEvent)getInitialEvent(); RequestVision rv = (RequestVision)req.getContent(); Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); Vision v = env.getVision(rv.getCreature()); rv.setVision(v); Done done = new Done(); done.setAction(rv); sendMessage(req.createReply("inform_done", done));*/ } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { DFRegister re = (DFRegister)getParameter("action").getValue(); IGoal reg = createGoal("df_register"); reg.getParameter("description").setValue(re.getComponentDescription()); dispatchSubgoalAndWait(reg); re.setResult((IDFComponentDescription)reg.getParameter("result").getValue()); getParameter("result").setValue(new Done(re)); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSSearchComponents sa = new CMSSearchComponents(); sa.setComponentDescription((IComponentDescription)getParameter("description").getValue()); sa.setSearchConstraints((ISearchConstraints)getParameter("constraints").getValue()); sa.setRemote(getParameter("remote").getValue()!=null? ((Boolean)getParameter("remote").getValue()).booleanValue(): false); IGoal req = createGoal("rp_initiate"); req.getParameter("receiver").setValue(getParameter("cms").getValue()); req.getParameter("action").setValue(sa); req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME); dispatchSubgoalAndWait(req); getParameterSet("result").addValues(((CMSSearchComponents)((Done)req.getParameter("result") .getValue()).getAction()).getComponentDescriptions()); } }
/** * The plan body. */ public void body() { /*IMessageEvent req = (IMessageEvent)getInitialEvent(); RequestWorldSize rws = (RequestWorldSize)req.getContent(); Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); rws.setWidth(env.getWidth()); rws.setHeight(env.getHeight()); Done done = new Done(); done.setAction(rws); sendMessage(req.createReply("inform_done", done));*/ RequestWorldSize rws = (RequestWorldSize)getParameter("action").getValue(); Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); rws.setWidth(env.getWidth()); rws.setHeight(env.getHeight()); Done done = new Done(); done.setAction(rws); getParameter("result").setValue(done); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { DFModify mo = (DFModify)getParameter("action").getValue(); IGoal reg = createGoal("df_modify"); reg.getParameter("description").setValue(mo.getComponentDescription()); dispatchSubgoalAndWait(reg); mo.setResult((IDFComponentDescription)reg.getParameter("result").getValue()); getParameter("result").setValue(new Done(mo)); } }