当前位置: 首页>>代码示例>>Java>>正文


Java ACLMessage.getInteger方法代码示例

本文整理汇总了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);
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:25,代码来源:JadeAg.java

示例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));            
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:30,代码来源:JadeAg.java

示例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\".");
	}
}
 
开发者ID:ROSAPL,项目名称:2APL_fork,代码行数:9,代码来源:SendAction.java

示例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;
}
 
开发者ID:ROSAPL,项目名称:2APL_fork,代码行数:13,代码来源:JadeMessenger.java

示例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");
    }
}
 
开发者ID:sandcast,项目名称:jade-camel,代码行数:50,代码来源:JadeProducer.java


注:本文中的jade.lang.acl.ACLMessage.getInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。