本文整理汇总了Java中jade.lang.acl.ACLMessage.REQUEST属性的典型用法代码示例。如果您正苦于以下问题:Java ACLMessage.REQUEST属性的具体用法?Java ACLMessage.REQUEST怎么用?Java ACLMessage.REQUEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类jade.lang.acl.ACLMessage
的用法示例。
在下文中一共展示了ACLMessage.REQUEST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: action
@Override
public void action() {
myAgent.getContentManager().registerLanguage(new SLCodec(), FIPANames.ContentLanguage.FIPA_SL0);
myAgent.getContentManager().registerOntology(JADEManagementOntology.getInstance());
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.addReceiver(myAgent.getDefaultDF());
msg.setOntology(JADEManagementOntology.NAME);
msg.setLanguage(FIPANames.ContentLanguage.FIPA_SL0);
msg.setProtocol(FIPANames.InteractionProtocol.FIPA_REQUEST);
Action a = new Action();
a.setActor( myAgent.getDefaultDF() );
a.setAction( new ShowGui() );
try {
myAgent.getContentManager().fillContent(msg,a);
} catch (Exception e) {
e.printStackTrace();
}
myAgent.send(msg);
myAgent.doDelete();
}
示例2: recycle
private void recycle()
{
if (!((GameAgent) myAgent).isTurnComplete())
{
if (Constant.DEBUG)
{
System.out.println("ResendTimeout is " + ResendTimeout);
}
if (0 == --ResendTimeout)
{
System.out.println("Resending move order...");
ACLMessage message = new ACLMessage(ACLMessage.REQUEST);
message.setOntology(GameVocabulary.ONTOLOGY);
message.setContent(GameVocabulary.MOVE_YOUR_BODY);
((GameAgent) myAgent).getAgentsToMove().forEach(agent -> message.addReceiver(agent));
myAgent.send(message);
ResendTimeout = Constant.GAME_RESEND_MOVE_ORDER_TIMEOUT;
}
}
}
示例3: aclToKqml
public static String aclToKqml(ACLMessage m) {
switch(m.getPerformative()) {
case ACLMessage.INFORM: return "tell";
case ACLMessage.QUERY_REF: return "askOne";
case ACLMessage.REQUEST: return "achieve";
/*case UNTELL: return "untell";
case UNACHIEVE: return "unachieve";
case ASKALL: return "askAll";
case ASKHOW: return "askHow";
case TELLHOW: return "tellHow";
case UNTELLHOW: return "untellHow";*/
case ACLMessage.INFORM_REF:
String kp = m.getUserDefinedParameter("kqml-performative");
if (kp != null) {
return kp;
}
break;
}
return ACLMessage.getPerformative(m.getPerformative()).toLowerCase().replaceAll("-", "_");
}
示例4: act
@Override
public void act(ActionExec action) { //, List<ActionExec> feedback) {
if (!isRunning()) return;
if (getEnvironmentAg() == null) return;
try {
Term acTerm = action.getActionTerm();
logger.fine("doing: " + acTerm);
String rw = "id"+jadeAg.incReplyWithId();
ACLMessage m = new ACLMessage(ACLMessage.REQUEST);
m.addReceiver(environmentAID);
m.setOntology(JadeEnvironment.actionOntology);
m.setContent(acTerm.toString());
m.setReplyWith(rw);
myPA.put(rw, action);
jadeAg.send(m);
} catch (Exception e) {
logger.log(Level.SEVERE, "Error sending action " + action, e);
}
}
示例5: kqmlToACL
public static ACLMessage kqmlToACL(String p) {
if (p.equals("tell")) {
return new ACLMessage(ACLMessage.INFORM);
} else if (p.equals("askOne")) {
return new ACLMessage(ACLMessage.QUERY_REF);
} else if (p.equals("achieve")) {
return new ACLMessage(ACLMessage.REQUEST);
} else if (p.toLowerCase().equals("accept_proposal")) {
return new ACLMessage(ACLMessage.ACCEPT_PROPOSAL);
} else if (p.toLowerCase().equals("reject_proposal")) {
return new ACLMessage(ACLMessage.REJECT_PROPOSAL);
} else if (p.toLowerCase().equals("query_if")) {
return new ACLMessage(ACLMessage.QUERY_IF);
} else if (p.toLowerCase().equals("inform_if")) {
return new ACLMessage(ACLMessage.INFORM_IF);
}
int perf = ACLMessage.getInteger(p);
if (perf == -1 || perf == ACLMessage.NOT_UNDERSTOOD) {
ACLMessage m = new ACLMessage(ACLMessage.INFORM_REF);
m.addUserDefinedParameter("kqml-performative", p);
return m;
}
return new ACLMessage(perf);
}
示例6: aclPerformativeToKqml
public static String aclPerformativeToKqml(ACLMessage m) {
switch(m.getPerformative()) {
case ACLMessage.INFORM:
return "tell";
case ACLMessage.QUERY_REF:
return "askOne";
case ACLMessage.REQUEST:
return "achieve";
case ACLMessage.INFORM_REF:
String kp = m.getUserDefinedParameter("kqml-performative");
if (kp != null) {
return kp;
}
break;
}
return ACLMessage.getPerformative(m.getPerformative()).toLowerCase().replaceAll("-", "_");
}
示例7: act
@Override
public void act(ActionExec action) {
if (!isRunning()) return;
if (getEnvironmentAg() == null) return;
try {
Term acTerm = action.getActionTerm();
logger.fine("doing: " + acTerm);
String rw = "id"+jadeAg.incReplyWithId();
ACLMessage m = new ACLMessage(ACLMessage.REQUEST);
m.addReceiver(environmentAID);
m.setOntology(JadeEnvironment.actionOntology);
m.setContent(acTerm.toString());
m.setReplyWith(rw);
myPA.put(rw, action);
jadeAg.send(m);
} catch (Exception e) {
logger.log(Level.SEVERE, "Error sending action " + action, e);
}
}
示例8: action
@Override
public void action() {
ACLMessage message = new ACLMessage(ACLMessage.REQUEST);
message.addReceiver(myAgent.getNoteAgentName());
move.setSpeed(position.speed);
pos.x = position.x;
pos.y = position.y;
pos.z = position.z;
move.setPos(pos);
my_data.setMove(move);
my_data.setVelocity_multiplier(velocity);
message.clearAllReplyTo();
message.addReplyTo(myAgent.getSoundAgentName());
my_data.setInstrumentType(myAgent.getSelectedInstrument());
my_data.setTimestamp(System.currentTimeMillis());
ObjectMapper mapper = new ObjectMapper();
StringWriter sw = new StringWriter();
try {
mapper.writeValue(sw, my_data);
message.setContent(sw.toString());
} catch (Exception e) {
e.printStackTrace();
}
myAgent.send(message);
}
示例9: action
@Override
public void action() {
MessageTemplate mt = MessageTemplate.and(MessageTemplate.MatchPerformative(ACLMessage.REQUEST),
MessageTemplate.MatchContent("listGroup"));
ACLMessage message=myAgent.receive(mt);
if(message!=null && message.getPerformative()==ACLMessage.REQUEST){
System.out.println(message.getContent()+"\n");
if(message.getContent().equals("listGroup")){
System.out.println("oklistGruop\n");
myAgent.addBehaviour(new GetListGameBehaviour(myAgent,message));
}
}
}
示例10: onTick
@Override
public void onTick() {
ACLMessage itemBroadcast = new ACLMessage(ACLMessage.REQUEST);
itemBroadcast.setProtocol("request-robot");
DFAgentDescription robotDesc = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType(RobotAgent.SERVICE_TYPE);
robotDesc.addServices(sd);
try {
for (DFAgentDescription desc : DFService.search(myAgent,
robotDesc)) {
itemBroadcast.addReceiver(desc.getName());
}
} catch (FIPAException e) {
e.printStackTrace();
}
send(itemBroadcast);
}
示例11: requestAllDeliveryRobots
private void requestAllDeliveryRobots() {
DFAgentDescription template = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType("shelfPicking");
template.addServices(sd);
try {
DFAgentDescription[] result = DFService.search(myAgent,
template);
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
for (DFAgentDescription agent : result) {
msg.addReceiver(agent.getName());
send(msg);
}
} catch (FIPAException fe) {
fe.printStackTrace();
}
System.out
.println("Picker: Asking all the delivery robots if they are available.");
}
示例12: requestOrder
private void requestOrder() {
DFAgentDescription template = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType("giveOrder");
template.addServices(sd);
try {
DFAgentDescription[] result = DFService.search(myAgent,
template);
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
for (DFAgentDescription agent : result) {
msg.addReceiver(agent.getName());
send(msg);
}
} catch (FIPAException fe) {
fe.printStackTrace();
}
}
示例13: kqmlToACL
public static ACLMessage kqmlToACL(String p) {
if (p.equals("tell")) {
return new ACLMessage(ACLMessage.INFORM);
} else if (p.equals("askOne")) {
return new ACLMessage(ACLMessage.QUERY_REF);
} else if (p.equals("achieve")) {
return new ACLMessage(ACLMessage.REQUEST);
} else if (p.equals("untell") ||
p.equals("unachieve") ||
p.equals("askAll") ||
p.equals("askHow") ||
p.equals("tellHow") ||
p.equals("untellHow")) {
ACLMessage m = new ACLMessage(ACLMessage.INFORM_REF);
m.addUserDefinedParameter("kqml-performative", p);
return m;
/*} else if (p.equals("unachieve")) {
return UNACHIEVE;
} else if (p.equals("askAll")) {
return ASKALL;
} else if (p.equals("askHow")) {
return ASKHOW;
} else if (p.equals("tellHow")) {
return TELLHOW;
} else if (p.equals("untellHow")) {
return UNTELLHOW;*/
}
return new ACLMessage(ACLMessage.getInteger(p));
}
示例14: predictCollision
private boolean predictCollision(){
for(int i = 0; i != _agent._broadcastAddr.length; ++i) {
ACLMessage messageToRobots = new ACLMessage(ACLMessage.REQUEST);
messageToRobots.addReceiver(_agent._broadcastAddr[i]);
messageToRobots.setProtocol("RobotPosition");
messageToRobots.setContent(String.valueOf(_state._position));
_agent.send(messageToRobots);
ACLMessage message = _agent.blockingReceive(MessageTemplate.MatchProtocol("RobotPosition"));
int Position = Integer.valueOf(message.getContent());
int factor = 0;
if(_agent.getName().equals(message.getSender().getName())){
continue;
}
for(int counter = _state._position; counter != Position; ++counter)
{
++factor;
if(counter == 16)
{
counter = 0;
}
}
if(factor < 2)
{
System.out.println("Collision predicted");
return true;
}
}
return false;
}
示例15: takeBlock
private void takeBlock(AID receiver) {
ACLMessage messageToSourcePalette = new ACLMessage(ACLMessage.REQUEST);
messageToSourcePalette.addReceiver(receiver);
messageToSourcePalette.setProtocol(this.currProtocol);
messageToSourcePalette.setContent(ServiceType.TAKE_BLOCK.name());
robotAgent.send(messageToSourcePalette);
}