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


Java ACLMessage.getOntology方法代码示例

本文整理汇总了Java中jade.lang.acl.ACLMessage.getOntology方法的典型用法代码示例。如果您正苦于以下问题:Java ACLMessage.getOntology方法的具体用法?Java ACLMessage.getOntology怎么用?Java ACLMessage.getOntology使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jade.lang.acl.ACLMessage的用法示例。


在下文中一共展示了ACLMessage.getOntology方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isActionFeedback

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
boolean isActionFeedback(ACLMessage m) {
    // check if there are feedbacks on requested action executions
    if (m.getOntology() != null && m.getOntology().equals(JadeEnvironment.actionOntology)) {
        String irt = m.getInReplyTo();
        if (irt != null) {
            ActionExec a = myPA.remove(irt);
            // was it a pending action?
            if (a != null) {
                if (m.getContent().equals("ok")) {
                    a.setResult(true);
                } else {
                    a.setResult(false);
                }
                actionExecuted(a);
            } else {
                logger.log(Level.SEVERE, "Error: received feedback for an Action that is not pending. The message is "+m);
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:23,代码来源:JasonBridgeArch.java

示例2: isActionFeedback

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
boolean isActionFeedback(ACLMessage m) {
    // check if there are feedbacks on requested action executions
    if (m.getOntology() != null && m.getOntology().equals(JadeEnvironment.actionOntology)) {
        String irt = m.getInReplyTo();
        if (irt != null) {
            ActionExec a = myPA.remove(irt);
            // was it a pending action?
            if (a != null) {
                a.setResult(m.getContent().equals("ok"));
                actionExecuted(a);
            } else {
                logger.log(Level.SEVERE, "Error: received feedback for an Action that is not pending. The message is "+m);
            }
        }
        return true;
    }
    return false;
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:19,代码来源:JasonBridgeArch.java

示例3: toAPLMessage

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private APLMessage toAPLMessage(ACLMessage msg, String receiver)
{
	String language = msg.getLanguage(); if (language==null) language = "null";
	String ontology = msg.getOntology(); if (ontology==null) ontology = "null";
	APLMessage message = new APLMessage();
	message.setSender(msg.getSender().getLocalName());
	message.setPerformative(ACLMessage.getPerformative(msg.getPerformative()).toLowerCase());
	message.setLanguage(language);
	message.setOntology(ontology);
	message.setContent(parseContent(msg.getContent()));
	message.setReceiver(receiver);
	return message;
}
 
开发者ID:ROSAPL,项目名称:2APL_fork,代码行数:14,代码来源:MessageBehaviour.java

示例4: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action()
{
    ACLMessage message = myAgent.receive();
    if (null != message)
    {
        System.out.println(myAgent.getLocalName() + " received " + message.getContent() + " from " + message.getSender().getLocalName());
        
        switch (message.getOntology())
        {
            case GameVocabulary.ONTOLOGY:
                switch (message.getContent())
                {
                    case GameVocabulary.START:
                    case GameVocabulary.CONTINUE:
                        ((PacmanAgent) myAgent).setGameRunning(true);
                        break;
                        
                    case GameVocabulary.PAUSE:
                        ((PacmanAgent) myAgent).setGameRunning(false);
                        break;
                    
                    case GameVocabulary.MOVE_YOUR_BODY:
                        if (!((PacmanAgent) myAgent).isMoving())
                        {
                            ((PacmanAgent) myAgent).setMoving(true);
                            myAgent.addBehaviour(new PacmanMovementBehaviour(message, board, myCell));
                        }
                        
                        break;
                        
                    default:
                        block();
                }
                
                break;
                
            default:
                block();
        }
    }
    else
    {
        block();
    }
}
 
开发者ID:wguilen,项目名称:pacman-mas,代码行数:47,代码来源:PacmanLifecycleBehaviour.java

示例5: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action()
{
    ACLMessage message = myAgent.receive();
    if (null != message)
    {
        System.out.println(myAgent.getLocalName() + " received " + message.getContent() + " from " + message.getSender().getLocalName());
        
        switch (message.getOntology())
        {
            case GameVocabulary.ONTOLOGY:
                switch (message.getContent())
                {
                    case GameVocabulary.CONTINUE:
                        ((GhostAgent) myAgent).setGameRunning(true);
                        break;
                        
                    case GameVocabulary.MOVE_YOUR_BODY:
                        if (!((GhostAgent) myAgent).isMoving())
                        {
                            ((GhostAgent) myAgent).setMoving(true);
                            myAgent.addBehaviour(new GhostMovementBehaviour(message, board, myCell));
                        }
                        else
                        {
                            System.out.println(myAgent.getLocalName() + " is already moving...");
                        }
                        
                        break;
                        
                    case GameVocabulary.PAUSE:
                        ((GhostAgent) myAgent).setGameRunning(false);
                        break;
                        
                    case GameVocabulary.START:
                        ((GhostAgent) myAgent).setGameRunning(true);
                        myAgent.addBehaviour(new GhostLeaveHouseFirstBehaviour(myAgent, board, myCell));
                        break;
                        
                    default:
                        block();
                }
                
                break;
                
            case GhostVocabulary.ONTOLOGY:
                switch (message.getContent())
                {
                    case GhostVocabulary.LEAVE_THE_HOUSE:
                        myAgent.addBehaviour(new GhostLeaveHouseNextBehaviour(myAgent, board, myCell));
                        break;
                        
                    case GhostVocabulary.GET_OUT_OF_MY_WAY:
                        ((GhostAgent) myAgent).setReverseDirection(true);
                        break;
                        
                    case GhostVocabulary.THE_MOTHERFUCKER_IS_DEAD:
                        ((GhostAgent) myAgent).setGameRunning(false);
                        System.out.println("YAAAAAY! " + myAgent.getLocalName() + " is happy because "
                                + "Pacman is finally dead!");
                        break;
                        
                    case GhostVocabulary.THE_MOTHERFUCKER_KILLED_ME:
                        System.out.println("Oh, no... " + message.getSender().getLocalName() + " was killed by the motherfucker... :(~");
                        // TODO: Run away from Pacman (if a ghost was killed, it means Pacman is powerful)
                        break;
                        
                    default:
                        block();
                }
                
            default:
                block();
        }
    }
    else
    {
        block();
    }
}
 
开发者ID:wguilen,项目名称:pacman-mas,代码行数:81,代码来源:GhostLifecycleBehaviour.java


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