本文整理汇总了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();
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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");
}
示例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");
}
示例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;
}
示例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;
}
示例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++;
}
}
}