/** * 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 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); } }
/** * 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 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 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 body method is called on the * instantiated plan instance from the scheduler. */ public void body() { DFModify mo = new DFModify(); IDFComponentDescription desc = (IDFComponentDescription)getParameter("description").getValue(); Number lt = (Number)getParameter("leasetime").getValue(); // When AID is ommited, enter self. Hack??? if(desc.getName()==null || lt!=null) { IComponentIdentifier bid = desc.getName()!=null ? desc.getName() : getScope().getComponentIdentifier(); Date leasetime = lt==null ? desc.getLeaseTime() : new Date(getTime()+lt.longValue()); desc = new DFComponentDescription(bid, desc.getServices(), desc.getProtocols(), desc.getOntologies(), desc.getLanguages(), leasetime); } mo.setComponentDescription(desc); IGoal req = createGoal("rp_initiate"); req.getParameter("receiver").setValue(getParameter("df").getValue()); req.getParameter("action").setValue(mo); req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME); dispatchSubgoalAndWait(req); getParameter("result").setValue(((DFModify)((Done)req.getParameter("result").getValue()).getAction()).getResult()); } }
/** * The body method is called on the * instantiated plan instance from the scheduler. */ public void body() { // System.out.println("df register"); DFRegister re = new DFRegister(); IDFComponentDescription desc = (IDFComponentDescription)getParameter("description").getValue(); Number lt = (Number)getParameter("leasetime").getValue(); // When AID is omitted, enter self. Hack??? if(desc.getName()==null || lt!=null) { IComponentIdentifier bid = desc.getName()!=null ? desc.getName() : getScope().getComponentIdentifier(); Date leasetime = lt==null ? desc.getLeaseTime() : new Date(getTime()+lt.longValue()); desc = new DFComponentDescription(bid, desc.getServices(), desc.getProtocols(), desc.getOntologies(), desc.getLanguages(), leasetime); } re.setComponentDescription(desc); IGoal req = createGoal("rp_initiate"); req.getParameter("receiver").setValue(getParameter("df").getValue()); req.getParameter("action").setValue(re); req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME); dispatchSubgoalAndWait(req); getParameter("result").setValue(((DFRegister)((Done)req.getParameter("result").getValue()).getAction()).getResult()); } }
/** * The body method is called on the * instantiated plan instance from the scheduler. */ public void body() { CMSCreateComponent ca = new CMSCreateComponent(); ca.setType((String)getParameter("type").getValue()); ca.setName((String)getParameter("name").getValue()); ca.setConfiguration((String)getParameter("configuration").getValue()); ca.setArguments((Map)getParameter("arguments").getValue()); ca.setSuspend(((Boolean)getParameter("suspend").getValue()).booleanValue()); ca.setMaster(((Boolean)getParameter("master").getValue()).booleanValue()); ca.setParent((IComponentIdentifier)getParameter("parent").getValue()); ca.setResourceIdentifier((IResourceIdentifier)getParameter("rid").getValue()); IGoal req = createGoal("rp_initiate"); req.getParameter("receiver").setValue(getParameter("cms").getValue()); req.getParameter("action").setValue(ca); req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME); dispatchSubgoalAndWait(req); getParameter("componentidentifier").setValue(((CMSCreateComponent)((Done)req.getParameter("result").getValue()).getAction()).getComponentIdentifier()); } }
int bet = ((RequestBet)((Done)content).getAction()).getBet(); if(bet>player.getAccount())
Environment env = (Environment)getBeliefbase().getBelief("environment").getFact(); env.clear(); Vision vision = ((RequestCompleteVision)((Done)rg.getParameter("result").getValue()).getAction()).getVision(); Cleaner[] cleaners = vision.getCleaners(); for(int i=0; i<cleaners.length; i++)