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


Java ACLMessage.QUERY_REF属性代码示例

本文整理汇总了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;
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:23,代码来源:JasonBridgeArch.java

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

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

示例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("-", "_");
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:17,代码来源:JadeAg.java

示例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;
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:25,代码来源:JasonBridgeArch.java

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


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