本文整理汇总了Java中jade.lang.acl.ACLMessage.getInteger方法的典型用法代码示例。如果您正苦于以下问题:Java ACLMessage.getInteger方法的具体用法?Java ACLMessage.getInteger怎么用?Java ACLMessage.getInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jade.lang.acl.ACLMessage
的用法示例。
在下文中一共展示了ACLMessage.getInteger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: kqmlToACL
import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
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);
}
示例2: kqmlToACL
import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
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));
}
示例3: checkPlan
import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
public void checkPlan(LinkedList<String> warnings, APLModule module)
{
if (performative instanceof APLIdent) {
String perf = performative.toString();
int p = ACLMessage.getInteger(perf);
if (p<0) warnings.add(""+perf+" is not a valid performative. It will be interpreted as \"not-understood\".");
}
}
示例4: toJadeMessage
import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private ACLMessage toJadeMessage(APLMessage message)
{
int p = ACLMessage.getInteger(message.getPerformative());
ACLMessage msg = new ACLMessage(p);
String aid = message.getReceiver();
boolean isguid = aid.contains("@");
msg.addReceiver(new AID(aid,isguid));
msg.setLanguage(message.getLanguage());
msg.setOntology(message.getOntology());
msg.setContent(message.getContent().toString());
return msg;
}
示例5: process
import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void process(Exchange exchange) throws Exception {
JadeConfiguration config = endpoint.getConfig();
Message inMessage = exchange.getIn();
Map<String, Object> headers = inMessage.getHeaders();
final int performative;
if (headers.containsKey(JadeConfiguration.JADE_PERFORMATIVE)) {
performative = ACLMessage.getInteger(inMessage.getHeader(JadeConfiguration.JADE_PERFORMATIVE, String.class));
} else {
performative = config.getPerformative() == null ? ACLMessage.REQUEST : ACLMessage.getInteger(config.getPerformative());
}
ACLMessage aclMessage = new ACLMessage(performative == ACLMessage.UNKNOWN ? ACLMessage.REQUEST : performative);
aclMessage.setContent(inMessage.getBody(String.class));
final String agentName;
if (headers.containsKey(JadeConfiguration.JADE_AGENT_NAME)) {
agentName = inMessage.getHeader(JadeConfiguration.JADE_AGENT_NAME, String.class);
} else {
agentName = config.getAgentName();
}
final String defaultForward;
if (headers.containsKey(JadeConfiguration.JADE_DEFAULT_FORWARD)) {
defaultForward = inMessage.getHeader(JadeConfiguration.JADE_DEFAULT_FORWARD, String.class);
} else {
defaultForward = config.getDefaultForward() == null ? agentName : config.getDefaultForward();
}
aclMessage.addReceiver(new AID(defaultForward, AID.ISLOCALNAME));
final String replyTo;
if (headers.containsKey(JadeConfiguration.JADE_REPLY_TO)) {
replyTo = inMessage.getHeader(JadeConfiguration.JADE_REPLY_TO, String.class);
} else {
replyTo = config.getReplyTo() == null ? agentName : config.getReplyTo();
}
aclMessage.addReplyTo(new AID(replyTo, AID.ISLOCALNAME));
inMessage.getHeaders().entrySet().stream().forEach((entry) -> {
aclMessage.addUserDefinedParameter(entry.getKey(), (String) entry.getValue());
});
AgentController agent = config.getContainer().getAgent(agentName, AID.ISLOCALNAME);
if (agent != null) {
agent.putO2AObject(aclMessage, false);
} else {
throw new NullPointerException("Target agent cannot be null");
}
}