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


Java ACLMessage.setLanguage方法代码示例

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


在下文中一共展示了ACLMessage.setLanguage方法的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() {
	ACLMessage msg = new ACLMessage(ACLMessage.QUERY_IF);
	msg.setLanguage("English");
	msg.setContent("free");
	DFAgentDescription orderPickerDesc = new DFAgentDescription();
	ServiceDescription sd = new ServiceDescription();
	sd.setType("pick");
	sd.setName("pick");
	orderPickerDesc.addServices(sd);
	try {
		for(DFAgentDescription desc : DFService.search(OrderAgent.this, orderPickerDesc)) {
			msg.addReceiver(desc.getName());
		}
	} catch(FIPAException ex) {
		ex.printStackTrace();
	}
	send(msg);
	pick = new OrderPickerPicker();
	addBehaviour(pick);
	removeBehaviour(query);
	query = null;
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:24,代码来源:OrderAgent.java

示例3: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	ACLMessage recMsg = receive(MessageTemplate.MatchPerformative(ACLMessage.FAILURE));
	if(recMsg != null) {
		ACLMessage response = new ACLMessage(ACLMessage.FAILURE);
		Order ordr = unfinishedOrders.get(recMsg.getSender());
		for(AID rec : ordr.requestingAgents) {
			response.addReceiver(rec);
		}
		response.setLanguage("English");
		response.setContent("Order " + ordr.id + " failed");
		System.out.println("WarehouseAgent: Failed order: " + ordr.id);
		send(response);
	} else {
		block();
	}			
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:18,代码来源:WarehouseAgent.java

示例4: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action()
{
	ACLMessage query_if = receive(MessageTemplate.MatchPerformative(ACLMessage.QUERY_IF));
	if (query_if != null && OrderPicker.this.isIdle)
	{
		ACLMessage response = query_if.createReply();
		response.setPerformative(ACLMessage.CONFIRM);
		response.setLanguage("JSON");
		response.setContent(new JSONObject().put(getLocalName(), true).toString());
		send(response);
	}
	else
	{
		block();
	}
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:18,代码来源:OrderPicker.java

示例5: sendMsgAvailableMachinesRequest

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
/**
 * Forwards a request for available machines to the server.cliebnt.
 */
private void sendMsgAvailableMachinesRequest() {
	
	// --- Get the local Address of JADE ------------------------
	String myPlatformAddress = myContainer.getPlatformID();
	
	// --- Define the AgentAction -------------------------------
	ClientAvailableMachinesRequest request = new ClientAvailableMachinesRequest();
	
	Action act = new Action();
	act.setActor(myContainer.getAMS());
	act.setAction(request);

	// --- Define receiver of the Message ----------------------- 
	AID agentGUIAgent = new AID("server.client" + "@" + myPlatformAddress, AID.ISGUID );
	//mainPlatformAgent.addAddresses(mainPlatform.getHttp4mtp());
	
	// --- Build Message ----------------------------------------
	ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
	msg.setSender(myContainer.getAMS());
	msg.addReceiver(agentGUIAgent);		
	msg.setLanguage(new SLCodec().getName());
	msg.setOntology(AgentGUI_DistributionOntology.getInstance().getName());
	try {
		msg.setContentObject(act);
	} catch (IOException errCont) {
		errCont.printStackTrace();
	}

	// --- Send message -----------------------------------------
	myContainer.postMessageToLocalAgent(msg, agentGUIAgent);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:35,代码来源:LoadService.java

示例6: sendMsgRemoteContainerRequest

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
/**
 * This method configures and send a ACLMessage to start a new remote-Container.
 *
 * @param remConf the RemoteContainerConfig
 * @param preventUsageOfAlreadyUsedComputers the boolean prevent usage of already used computers
 * @return the name of the container
 */
private String sendMsgRemoteContainerRequest(RemoteContainerConfig remConf) {
	
	// --- If the remote-configuration is null configure it now -
	if (remConf==null) {
		remConf = this.getRemoteContainerConfigAuto();
	}
	
	// --- Define the AgentAction -------------------------------
	ClientRemoteContainerRequest req = new ClientRemoteContainerRequest();
	req.setRemoteConfig(remConf);
	
	Action act = new Action();
	act.setActor(myContainer.getAMS());
	act.setAction(req);

	// --- Define receiver of the Message ----------------------- 
	AID agentGUIAgent = new AID(Platform.BackgroundSystemAgentApplication +  "@" + this.myContainer.getPlatformID(), AID.ISGUID);
	
	// --- Build Message ----------------------------------------
	ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
	msg.setSender(myContainer.getAMS());
	msg.addReceiver(agentGUIAgent);		
	msg.setLanguage(new SLCodec().getName());
	msg.setOntology(AgentGUI_DistributionOntology.getInstance().getName());
	try {
		msg.setContentObject(act);
	} catch (IOException errCont) {
		errCont.printStackTrace();
	}

	// --- Send message -----------------------------------------
	myContainer.postMessageToLocalAgent(msg, agentGUIAgent);
	
	// --- Remind, that we're waiting for this container --------
	loadInfo.setNewContainer2Wait4(remConf.getJadeContainerName());
	
	// --- Return -----------------------------------------------
	return remConf.getJadeContainerName();
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:47,代码来源:LoadService.java

示例7: action

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

	// --- Wait for the start of the LoadMeasureAgent -----------
	AgentController ageCont = null;
	while (ageCont==null) {
		try {
			ageCont = myAgent.getContainerController().getAgent(loadAgentName);
		} catch (ControllerException e1) {
			block(100);
			//e1.printStackTrace();
		}
	}
	
	myAgent.getContentManager().registerLanguage(new SLCodec(), FIPANames.ContentLanguage.FIPA_SL0);
	myAgent.getContentManager().registerOntology(JADEManagementOntology.getInstance());

	AID receiver = new AID();   
	receiver.setLocalName(loadAgentName);
	
	ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
	msg.addReceiver(receiver);
	msg.setOntology(JADEManagementOntology.NAME);
	msg.setLanguage(FIPANames.ContentLanguage.FIPA_SL0);
	
	Action a = new Action();
	a.setActor( receiver );
	a.setAction(new ShowThreadGUI());  
	try {
		myAgent.getContentManager().fillContent(msg,a);
	} catch (Exception e) {
		e.printStackTrace();
	}
	myAgent.send(msg);
	myAgent.doDelete();
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:37,代码来源:ShowThreadMonitorBehaviour.java

示例8: action

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

	// --- Wait for the start of the LoadMeasureAgent -----------
	long waitTimeMax = System.currentTimeMillis() + (1000 * 7);
	AgentController ageCont = null;
	while (ageCont==null) {
		if (System.currentTimeMillis()>=waitTimeMax) break;
		try {
			ageCont = myAgent.getContainerController().getAgent(loadAgentName);
		} catch (ControllerException e1) {
			block(100);
		}
	}
	
	this.myAgent.getContentManager().registerLanguage(new SLCodec(), FIPANames.ContentLanguage.FIPA_SL0);
	this.myAgent.getContentManager().registerOntology(JADEManagementOntology.getInstance());

	AID receiver = new AID();   
	receiver.setLocalName(loadAgentName);
	
	ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
	msg.addReceiver(receiver);
	msg.setOntology(JADEManagementOntology.NAME);
	msg.setLanguage(FIPANames.ContentLanguage.FIPA_SL0);
	
	Action a = new Action();
	a.setActor( receiver );
	a.setAction( new ShowMonitorGUI() );
	try {
		this.myAgent.getContentManager().fillContent(msg,a);
	} catch (Exception e) {
		e.printStackTrace();
	}
	this.myAgent.send(msg);
	this.myAgent.doDelete();
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:38,代码来源:ShowLoadMonitorBehaviour.java

示例9: jasonToACL

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
protected ACLMessage jasonToACL(Message m) throws IOException {
    ACLMessage acl = kqmlToACL(m.getIlForce());
    // send content as string if it is a Term/String (it is better for interoperability)
    if (m.getPropCont() instanceof Term || m.getPropCont() instanceof String) {
        acl.setContent(m.getPropCont().toString());         
    } else {
        acl.setContentObject((Serializable)m.getPropCont());
    }
    acl.setReplyWith(m.getMsgId());
    acl.setLanguage("AgentSpeak");
    if (m.getInReplyTo() != null) {
        acl.setInReplyTo(m.getInReplyTo());
    }
    return acl;
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:16,代码来源:JadeAg.java

示例10: jasonToACL

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
protected ACLMessage jasonToACL(Message m) throws IOException {
    ACLMessage acl = kqmlToACL(m.getIlForce());
    // send content as string if it is a Term/String (it is better for interoperability)
    if (m.getPropCont() instanceof Term || m.getPropCont() instanceof String) {
        acl.setContent(m.getPropCont().toString());
    } else {
        acl.setContentObject((Serializable)m.getPropCont());
    }
    acl.setReplyWith(m.getMsgId());
    acl.setLanguage("AgentSpeak");
    if (m.getInReplyTo() != null) {
        acl.setInReplyTo(m.getInReplyTo());
    }
    return acl;
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:16,代码来源:JadeAg.java

示例11: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	sm.Log("SendConfigurationToClassifiers - start");
	sm.Log("Looking for agents online");
	jade.util.leap.List Classifiers = JadeAgents.SearchAgents(myAgent,
			"Classifier Agent", null);
	sm.Log("Agents found: " + Classifiers.size());
	Iterator<?> classifiers = Classifiers.iterator();

	myAgent.ConfigureDataSet();
	DatasetManager datasetManager = myAgent.getDatasetManager();
	ArrayList<Arff_Training_Repository> datasetsTraining = datasetManager
			.getDatasetsTraining();

	int i = 0;
	while (classifiers.hasNext()) {
		AID server = (AID) classifiers.next();

		sm.Log("Sending data to : " + server.toString());

		ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
		msg.setLanguage(codec.getName());
		msg.setOntology(ontology.getName());
		try {
			Arff_Training_Repository arff = datasetsTraining.get(i);
			myAgent.getContentManager().fillContent(msg,
					new Action(server, arff));
			msg.addReceiver(server);
			myAgent.send(msg);
			i++;
			System.out.println("Contacting client... Please wait!");
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
	sm.Log("SendConfigurationToClassifiers - end");
}
 
开发者ID:JordiCorbilla,项目名称:DDM,代码行数:38,代码来源:SendTrainingDataBehaviour.java

示例12: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	sm.Log("SendConfigurationToClassifiers - start");
	sm.Log("Looking for agents online");
	jade.util.leap.List Classifiers = JadeAgents.SearchAgents(myAgent, "Classifier Agent", null);
	sm.Log("Agents found: " + Classifiers.size());
	Iterator<?> classifiers = Classifiers.iterator();

	while (classifiers.hasNext()) {
		AID server = (AID) classifiers.next();

		sm.Log("Sending data to : " + server.toString());

		ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
		msg.setLanguage(codec.getName());
		msg.setOntology(ontology.getName());
		try {
			ManagerSettings ms = new ManagerSettings();
			String value = myAgent.getConfiguration().getClassifierModule().get(server.getLocalName());
			if ((value == null) || value.equals(""))
				value = "random";
			ms.setClassifierModule(value);
			myAgent.getContentManager().fillContent(msg, new Action(server, ms));
			msg.addReceiver(server);
			myAgent.send(msg);
			System.out.println("Contacting client... Please wait!");
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
	sm.Log("SendConfigurationToClassifiers - end");
}
 
开发者ID:JordiCorbilla,项目名称:DDM,代码行数:33,代码来源:SendConfigurationToClassifierBehaviour.java

示例13: prepareMessage

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
public static ACLMessage prepareMessage(int type, String language, String content, AID target){
	ACLMessage message = new ACLMessage(type);
	message.setLanguage(language);
	message.addReceiver(target);
	message.setContent(content);
	
	return message;
}
 
开发者ID:gabriel-augusto,项目名称:AcSimus,代码行数:9,代码来源:Message.java

示例14: success

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private void success() {
	ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
	msg.setLanguage("English");
	msg.setContent("checked");
	DFAgentDescription whDesc = new DFAgentDescription();
	ServiceDescription sd = new ServiceDescription();
	sd.setName("WarehouseAgent");
	whDesc.addServices(sd);
	try {
		DFAgentDescription[] desc = DFService.search(OrderAgent.this, whDesc);
		if(desc.length == 1) {
			msg.addReceiver(desc[0].getName());
		} else {
			if(desc.length > 1) {
				System.err.println("Multiple WarehouseAgents found");
			} else {
				System.err.println("No WarehouseAgent found");
			}
		}
	} catch(FIPAException ex) {
		ex.printStackTrace();
	}
	send(msg);
	removeBehaviour(finish);
	removeBehaviour(fail);
	finish = null;
	fail = null;
	done = true;
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:30,代码来源:OrderAgent.java

示例15: 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


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