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


Java ACLMessage.getPerformative方法代码示例

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


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

示例1: aclToKqml

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
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,代码行数:21,代码来源:JadeAg.java

示例2: aclPerformativeToKqml

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
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,代码行数:18,代码来源:JadeAg.java

示例3: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	DFAgentDescription[] cleanServices = findCleanServices();
	if (cleanServices != null) {
		if (!_controller.doWork()) {
			// failure
		} else {
			if(this.serviceName.equals("needClean")){
				_communicator.requestCleanBlock();
			} else {
				_communicator.requestPaintBlock();;
			}
			ACLMessage reply = _communicator.receiveReply();
			if (reply.getPerformative() == ACLMessage.INFORM) {
				System.out.println(this.myAgent.getAID().getLocalName() + ": performed working successfully");
			} else {
				System.out.println("working failed");
			}
		}
	}
	this.myAgent.doWait(1000);
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:23,代码来源:WorkerBehaviour.java

示例4: moveAndgetBlockFromSourcePalette

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void moveAndgetBlockFromSourcePalette() {
	// _controller.move(sourcePaletteColor);
	// _agent.broadCastColor(sourcePaletteColor);
	//this.sendPosition((byte) 2);
	_robotToStationCommunicator.requestDirtyBlock();
	ACLMessage reply = _robotToStationCommunicator.receiveReply();
	if (reply.getPerformative() == ACLMessage.INFORM) {
		try {
			_state.block = (Block) reply.getContentObject();
			_state.isCarryingBlock = true;
		} catch (UnreadableException e) {
			e.printStackTrace();
		}
	} else {
		// Exception handlung
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:18,代码来源:TransporterBehaviour.java

示例5: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	ACLMessage message = receive();

	if (message != null && message.getPerformative() == ACLMessage.INFORM) {
		AID sender = message.getSender();

		if (message.getContent().equals(Message.FINISH_SIMULATION)){
			countSoundSourcesFinished++;
			if(countSoundSourcesFinished==ambient.getSoundSources().size()){
				finishSimulation();
				System.out.println("Simulation finished.");
				countSoundSourcesFinished=0;
			}
		}
		else {
			send(Message.getAnswerOfANotUnderstoodMessage(sender));					
		}
	}
}
 
开发者ID:gabriel-augusto,项目名称:AcSimus,代码行数:21,代码来源:Ambient.java

示例6: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	MessageTemplate mt = MessageTemplate.and(MessageTemplate.MatchPerformative(ACLMessage.REQUEST), 
			 		MessageTemplate.MatchContent("listGroup"));
	
	ACLMessage message=myAgent.receive(mt);
	
	if(message!=null && message.getPerformative()==ACLMessage.REQUEST){
		System.out.println(message.getContent()+"\n");
		if(message.getContent().equals("listGroup")){
			System.out.println("oklistGruop\n");
			myAgent.addBehaviour(new GetListGameBehaviour(myAgent,message));
		}
	}
		
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:17,代码来源:GameDaemonBehaviour.java

示例7: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	final MessageTemplate mt = MessageTemplate.MatchConversationId(conversationId);
	final ACLMessage request = myAgent.receive(mt);
	if (request == null) {
		block();
	} else {
		switch (request.getPerformative()) {
		case ACLMessage.CFP:
			respondToCfp(request);
			return;
		case ACLMessage.ACCEPT_PROPOSAL:
			respondToAcceptProposal(request);
			return;
		case ACLMessage.REJECT_PROPOSAL:
			return;
		default:
			return;
		}
	}
}
 
开发者ID:overheadhunter,项目名称:jade-factory,代码行数:22,代码来源:ProposingBehaviour.java

示例8: moveAndDropBlockOnCleaningFloor

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void moveAndDropBlockOnCleaningFloor() {
	// _controller.move(cleaningFloorColor); // 2. move to cleaning floor
	// _agent.broadCastColor(cleaningFloorColor);
	//this.sendPosition((byte) 6);
	_robotToStationCommunicator.giveDirtyBlock(_state.block);
	ACLMessage reply = _robotToStationCommunicator.receiveReply();
	if (reply.getPerformative() == ACLMessage.INFORM) {
		_state.block.Status = Block.possibleBlockStatus.NULL;
		_state.isCarryingBlock = false;
	} else {
		System.out.println("dropping failed due to communication");
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:14,代码来源:TransporterBehaviour.java

示例9: moveAndDropBlockOnPaintingFloor

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void moveAndDropBlockOnPaintingFloor() {
	// _controller.move(paintingFloorColor); // 2. move to cleaning floor
	// _agent.broadCastColor(paintingFloorColor);
	//this.sendPosition((byte) 9);
	_robotToStationCommunicator.giveCleanedBlock(_state.block);
	ACLMessage reply = _robotToStationCommunicator.receiveReply();
	if (reply.getPerformative() == ACLMessage.INFORM) {
		_state.block.Status = Block.possibleBlockStatus.NULL;
		_state.isCarryingBlock = false;
	} else {
		// He sent failure -> exception handling
	}

}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:15,代码来源:TransporterBehaviour.java

示例10: waitAndGetCleanedBlock

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void waitAndGetCleanedBlock() {
	_robotToStationCommunicator.requestCleanedBlock();
	ACLMessage reply = _robotToStationCommunicator.receiveReply();
	while (reply.getPerformative() == ACLMessage.FAILURE) {
		myAgent.doWait(1000);
		_robotToStationCommunicator.requestCleanedBlock();
		reply = _robotToStationCommunicator.receiveReply();
	}
	try {
		_state.block = (Block) reply.getContentObject();
		_state.isCarryingBlock = true;
	} catch (UnreadableException e) {
		e.printStackTrace();
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:16,代码来源:TransporterBehaviour.java

示例11: waitAndGetPaintedBlock

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void waitAndGetPaintedBlock() {
	_robotToStationCommunicator.requestPaintedBlock();
	ACLMessage reply = _robotToStationCommunicator.receiveReply();
	while (reply.getPerformative() == ACLMessage.FAILURE) {
		myAgent.doWait(1000);
		_robotToStationCommunicator.requestCleanedBlock();
		reply = _robotToStationCommunicator.receiveReply();
	}
	try {
		_state.block = (Block) reply.getContentObject();
		_state.isCarryingBlock = true;
	} catch (UnreadableException e) {
		e.printStackTrace();
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:16,代码来源:TransporterBehaviour.java

示例12: moveAndDropBlockOnGoalPalette

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void moveAndDropBlockOnGoalPalette() {
	// _controller.move(goalPaletteColor); // 2. move to cleaning floor
	// _agent.broadCastColor(goalPaletteColor);
	//this.sendPosition((byte) 13);
	_robotToStationCommunicator.givePaintedBlock(_state.block);
	ACLMessage reply = _robotToStationCommunicator.receiveReply();
	if (reply.getPerformative() == ACLMessage.INFORM) {
		_state.block.Status = Block.possibleBlockStatus.NULL;
		_state.isCarryingBlock = false;
	} else {
		System.out.println("dropping failed");
	}

}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:15,代码来源:TransporterBehaviour.java

示例13: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	ACLMessage message = receive();

	if (message != null && message.getPerformative() == ACLMessage.INFORM) {
		AID sender = message.getSender();

		if (message.getContent().equals(Message.STOP_RESUMED)){
			send(soundSource.stopSimulation(Message.STOP_RESUMED));
			System.out.println("Simulation stoped.");
		}
              else if (message.getContent().equals(Message.STOP_PAUSED)){
			send(soundSource.stopSimulation(Message.STOP_PAUSED));
			System.out.println("Simulation stoped.");
		}
		else if(message.getContent().equals(Message.PAUSE)){
			send(soundSource.suspendAllSounds());
		}
		else if(message.getContent().equals(Message.RESUME)){
			soundSource.resumeAllSounds();
		}
		else if(message.getContent().equals(Message.RUN)){
			soundSource.emitSoundPulse();
		}
		else if(message.getLanguage().equals(Language.FINISH)){
			soundSource.getSounds().remove(message.getContent());
			if(soundSource.getSounds().isEmpty()){
				send(Message.prepareMessage(ACLMessage.INFORM, null, Message.FINISH_SIMULATION, soundSource.getAmbient()));
			}
		}
		else {
			send(Message.getAnswerOfANotUnderstoodMessage(sender));					
		}
	}

}
 
开发者ID:gabriel-augusto,项目名称:AcSimus,代码行数:37,代码来源:SoundSource.java

示例14: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	ACLMessage message = receive();

	if (message != null && message.getPerformative() == ACLMessage.INFORM) {
		if (message.getContent().equals(Message.STOP_RESUMED)){
			killSound();
		}
		else if(message.getContent().equals(Message.PAUSE)){
			doSuspend();
		}
	}
}
 
开发者ID:gabriel-augusto,项目名称:AcSimus,代码行数:14,代码来源:Sound.java

示例15: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void action() {
	if(first){
		ACLMessage multiPlayRegister = new ACLMessage(ACLMessage.SUBSCRIBE);
		multiPlayRegister.setConversationId("register");
		multiPlayRegister.setSender(myAgent.getAID());
		multiPlayRegister.addReceiver(myAgent.getServerName());
		multiPlayRegister.setContent("getting in");
		myAgent.send(multiPlayRegister);
		first = false;
	}
	
	if(!myAgent.isMultiple_mode()){
			ACLMessage multiPlayUnregister = new ACLMessage(ACLMessage.SUBSCRIBE);
			multiPlayUnregister.setConversationId("unregister");
			multiPlayUnregister.setSender(myAgent.getAID());
			multiPlayUnregister.addReceiver(myAgent.getServerName());
			multiPlayUnregister.setContent("getting out");
			myAgent.send(multiPlayUnregister);
			
			done=true;
	}
	
	MessageTemplate mt = 
			MessageTemplate.and(MessageTemplate.MatchConversationId("updateDICT"),
								MessageTemplate.MatchPerformative(ACLMessage.INFORM));
	ACLMessage update_message = myAgent.receive(mt);
	if(update_message!=null){
		System.out.println("receive update dict");
		if(update_message.getPerformative()==ACLMessage.INFORM){
			try {
				 myAgent.setDict((DefaultListModel<String>)update_message.getContentObject());
			} catch (UnreadableException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:41,代码来源:MultiPlayUpdateBehaviour.java


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