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


Java ACLMessage.setProtocol方法代码示例

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


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

示例1: action

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

	myAgent.getContentManager().registerLanguage(new SLCodec(), FIPANames.ContentLanguage.FIPA_SL0);
	myAgent.getContentManager().registerOntology(JADEManagementOntology.getInstance());

	ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
	msg.addReceiver(myAgent.getDefaultDF());
	msg.setOntology(JADEManagementOntology.NAME);
	msg.setLanguage(FIPANames.ContentLanguage.FIPA_SL0);
	msg.setProtocol(FIPANames.InteractionProtocol.FIPA_REQUEST);
	Action a = new Action();
	a.setActor( myAgent.getDefaultDF() );
	a.setAction( new ShowGui() );
	try {
		myAgent.getContentManager().fillContent(msg,a);
	} catch (Exception e) {
		e.printStackTrace();
	}
	myAgent.send(msg);
	myAgent.doDelete();
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:23,代码来源:ShowDFBehaviour.java

示例2: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action()
{
	removeBehaviour(OrderPicker.this.abortOrder);
	removeBehaviour(OrderPicker.this.shelfInteraction);

	log("Order complete, send INFORM to " + OrderPicker.this.currentOrderAgent.getLocalName() + "!");

	ACLMessage inform = new ACLMessage(ACLMessage.INFORM);
	inform.addReceiver(OrderPicker.this.currentOrderAgent);
	inform.setLanguage("JSON");
	inform.setProtocol("JSON");
	inform.setContent(OrderPicker.this.orderOutgoing.toString());
	send(inform);

	OrderPicker.this.itemStatus.clear();
	OrderPicker.this.shelfInfo.clear();
	OrderPicker.this.orderOutgoing = null;
	OrderPicker.this.orderOutgoing = new JSONArray();

	OrderPicker.this.isIdle = true;

	removeBehaviour(this);
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:25,代码来源:OrderPicker.java

示例3: action

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

	log("Transport " + currentShelf.getLocalName() + " back home");

	int transportDelay = rand.nextInt(5);
	block(transportDelay * 1000);

	ACLMessage message = new ACLMessage(ACLMessage.INFORM);
	message.addReceiver(currentShelf);
	message.setProtocol("request-robot");
	myAgent.send(message);

	currentShelf = null;
	isIdle = true;
	promisedProposal = false;
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:18,代码来源:RobotAgent.java

示例4: onTick

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

	ACLMessage itemBroadcast = new ACLMessage(ACLMessage.REQUEST);
	itemBroadcast.setProtocol("request-robot");

	DFAgentDescription robotDesc = new DFAgentDescription();
	ServiceDescription sd = new ServiceDescription();
	sd.setType(RobotAgent.SERVICE_TYPE);
	robotDesc.addServices(sd);
	try {
		for (DFAgentDescription desc : DFService.search(myAgent,
				robotDesc)) {
			itemBroadcast.addReceiver(desc.getName());
		}
	} catch (FIPAException e) {
		e.printStackTrace();
	}

	send(itemBroadcast);
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:22,代码来源:ShelfAgent.java

示例5: predictCollision

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private boolean predictCollision(){

		for(int i = 0; i != _agent._broadcastAddr.length; ++i) {
			ACLMessage messageToRobots = new ACLMessage(ACLMessage.REQUEST);
			messageToRobots.addReceiver(_agent._broadcastAddr[i]);
			messageToRobots.setProtocol("RobotPosition");
			messageToRobots.setContent(String.valueOf(_state._position));
			_agent.send(messageToRobots);

			ACLMessage message = _agent.blockingReceive(MessageTemplate.MatchProtocol("RobotPosition"));
			int Position = Integer.valueOf(message.getContent());
			int factor = 0;
			if(_agent.getName().equals(message.getSender().getName())){
				continue;
			}
			for(int counter = _state._position; counter != Position; ++counter)
			{
				++factor;
				if(counter == 16)
				{
					counter = 0;
				}
			}
			if(factor < 2)
			{
				System.out.println("Collision predicted");
				return true;
			}
		}

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

示例6: takeBlock

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void takeBlock(AID receiver) {
	ACLMessage messageToSourcePalette = new ACLMessage(ACLMessage.REQUEST);
	messageToSourcePalette.addReceiver(receiver);
	messageToSourcePalette.setProtocol(this.currProtocol);
	messageToSourcePalette.setContent(ServiceType.TAKE_BLOCK.name());
	robotAgent.send(messageToSourcePalette);
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:8,代码来源:RobotToStationCommunicator.java

示例7: giveBlock

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void giveBlock(AID receiver, Block block) {
	ACLMessage messageToSourcePalette = new ACLMessage(ACLMessage.REQUEST);
	messageToSourcePalette.addReceiver(receiver);
	messageToSourcePalette.setProtocol(this.currProtocol);
	try {
		messageToSourcePalette.setContentObject(block);
	} catch (IOException e) {
		e.printStackTrace();
	}
	robotAgent.send(messageToSourcePalette);
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:12,代码来源:RobotToStationCommunicator.java

示例8: finishBlock

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void finishBlock(AID receiver) {
	ACLMessage messageToFloor = new ACLMessage(ACLMessage.REQUEST);
	messageToFloor.addReceiver(receiver);
	messageToFloor.setProtocol(this.currProtocol);
	messageToFloor.setContent(ServiceType.FINISH_BLOCK.name());
	robotAgent.send(messageToFloor);
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:8,代码来源:RobotToStationCommunicator.java

示例9: occupyBlock

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void occupyBlock(AID receiver){
	ACLMessage messageToFloor = new ACLMessage(ACLMessage.REQUEST);
	messageToFloor.addReceiver(receiver);
	messageToFloor.setProtocol(this.currProtocol);
	messageToFloor.setContent(ServiceType.I_OCCUPY.name());
	robotAgent.send(messageToFloor);
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:8,代码来源:RobotToStationCommunicator.java

示例10: sendSkills

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
void sendSkills(AID receiver, String strContent )
{
	ACLMessage messageSkill = new ACLMessage(ACLMessage.INFORM);
	messageSkill.addReceiver(receiver);
	messageSkill.setProtocol("Skills");
	messageSkill.setContent(strContent);
	this.send(messageSkill);
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:9,代码来源:RobotAgent.java

示例11: updateTrack

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public ACLMessage updateTrack() {
	ACLMessage messageToTrackAgent = new ACLMessage(ACLMessage.INFORM);
	messageToTrackAgent.setProtocol(ProtocolTemplates.TrackProtocolTemplate.TRACK_FLOOR_PROTOCOL);
	try {
		messageToTrackAgent.setContentObject(this.floor);
	} catch (IOException e) {
		e.printStackTrace();
	}
	messageToTrackAgent.addReceiver(new AID("TrackAgent", AID.ISLOCALNAME));
	return messageToTrackAgent;
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:13,代码来源:FloorCommunicator.java

示例12: updateTrack

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public ACLMessage updateTrack() {
	ACLMessage messageToTrackAgent = new ACLMessage(ACLMessage.INFORM);
	messageToTrackAgent.setProtocol(ProtocolTemplates.TrackProtocolTemplate.TRACK_PALETTE_PROTOCOL);
	try {
		messageToTrackAgent.setContentObject(this.goalPalette);
	} catch (IOException e) {
		e.printStackTrace();
	}
	messageToTrackAgent.addReceiver(new AID("TrackAgent", AID.ISLOCALNAME));
	return messageToTrackAgent;
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:13,代码来源:GoalPaletteCommunicator.java

示例13: updateTrack

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public ACLMessage updateTrack() {
	ACLMessage messageToTrackAgent = new ACLMessage(ACLMessage.INFORM);
	messageToTrackAgent.setProtocol(ProtocolTemplates.TrackProtocolTemplate.TRACK_PALETTE_PROTOCOL);
	try {
		messageToTrackAgent.setContentObject(this.sourcePalette);
	} catch (IOException e) {
		e.printStackTrace();
	}
	messageToTrackAgent.addReceiver(new AID("TrackAgent", AID.ISLOCALNAME));
	return messageToTrackAgent;
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:13,代码来源:SourcePaletteCommunicator.java

示例14: onTick

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void onTick()
{
	if (checkOrderCompletion())
	{
		removeBehaviour(this);
	}
	else
	{
		if (this.i == OrderPicker.this.orderIncoming.length())
		{
			removeBehaviour(OrderPicker.this.shelfInteraction);

			log("Could not complete the order in time window, send FAILURE and partial complete order to "
					+ OrderPicker.this.currentOrderAgent.getLocalName() + "!");

			ACLMessage inform = new ACLMessage(ACLMessage.FAILURE);
			inform.addReceiver(OrderPicker.this.currentOrderAgent);
			inform.setLanguage("JSON");
			inform.setProtocol("JSON");
			inform.setContent(OrderPicker.this.orderOutgoing.toString());
			send(inform);

			OrderPicker.this.itemStatus.clear();
			OrderPicker.this.shelfInfo.clear();
			OrderPicker.this.orderOutgoing = null;
			OrderPicker.this.orderOutgoing = new JSONArray();

			OrderPicker.this.isIdle = true;

			removeBehaviour(this);
		}
		else
		{
			timeOutRebroadcast();
			this.i++;
		}
	}

}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:41,代码来源:OrderPicker.java

示例15: action

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

	// INFORM THE ORDER PICKER
	ACLMessage informOrderPickerMessage = new ACLMessage(
			ACLMessage.INFORM);
	informOrderPickerMessage.setProtocol("request-item");
	informOrderPickerMessage.addReceiver(currentOrderPicker);
	informOrderPickerMessage.setContent(currentItemRequest);
	send(informOrderPickerMessage);

	currentPickupWaitBehaviour = new PickupWait(myAgent, WAIT_LIMIT);
	myAgent.addBehaviour(currentPickupWaitBehaviour);
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:15,代码来源:ShelfAgent.java


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