本文整理汇总了Java中jade.lang.acl.ACLMessage.QUERY_REF属性的典型用法代码示例。如果您正苦于以下问题:Java ACLMessage.QUERY_REF属性的具体用法?Java ACLMessage.QUERY_REF怎么用?Java ACLMessage.QUERY_REF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类jade.lang.acl.ACLMessage
的用法示例。
在下文中一共展示了ACLMessage.QUERY_REF属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: perceive
@SuppressWarnings("unchecked")
@Override
public List<Literal> perceive() {
if (!isRunning()) return null;
if (getEnvironmentAg() == null) return null;
@SuppressWarnings("rawtypes")
List percepts = null;
try {
ACLMessage askMsg = new ACLMessage(ACLMessage.QUERY_REF);
askMsg.addReceiver(environmentAID);
askMsg.setOntology(JadeEnvironment.perceptionOntology);
askMsg.setContent("getPercepts");
ACLMessage r = jadeAg.ask(askMsg);
if (r != null && r.getContent().startsWith("[")) {
percepts = ListTermImpl.parseList(r.getContent());
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Error in perceive.", e);
}
return percepts;
}
示例2: 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("-", "_");
}
示例3: 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);
}
示例4: 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("-", "_");
}
示例5: perceive
@SuppressWarnings("unchecked")
@Override
public List<Literal> perceive() {
super.perceive();
if (!isRunning()) return null;
if (getEnvironmentAg() == null) return null;
@SuppressWarnings("rawtypes")
List percepts = null;
try {
ACLMessage askMsg = new ACLMessage(ACLMessage.QUERY_REF);
askMsg.addReceiver(environmentAID);
askMsg.setOntology(JadeEnvironment.perceptionOntology);
askMsg.setContent("getPercepts");
ACLMessage r = jadeAg.ask(askMsg);
if (r != null && r.getContent().startsWith("[")) {
percepts = ListTermImpl.parseList(r.getContent());
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Error in perceive.", e);
}
return percepts;
}
示例6: 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));
}