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


Java ACLMessage.setContentObject方法代码示例

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


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

示例1: processExecutionControlOntologyMsg

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
boolean processExecutionControlOntologyMsg() {
    ACLMessage m = receive(ts);
    if (m != null) {
        // send the agent state
        ACLMessage r = m.createReply();
        r.setPerformative(ACLMessage.INFORM);
        try {
            Document agStateDoc = jasonBridgeAgArch.getTS().getAg().getAgState();
            r.setContentObject((Serializable)agStateDoc);
            send(r);
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Error sending message " + r, e);
        }            
    }
    
    m = receive(tc);
    if (m != null) {
        int cycle = Integer.parseInt(m.getUserDefinedParameter("cycle"));
        logger.fine("new cycle: "+cycle);
        jasonBridgeAgArch.setCycleNumber(cycle);
        return true;
    }
    return false;
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:25,代码来源:JadeAgArch.java

示例2: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
public void action() {
     ResultsAgent a = (ResultsAgent)myAgent;
     
      // Send result before closing down
     ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
     msg.setSender(a.getAID());
     msg.addReceiver(new AID(SendTo, false));
     try {
         Object[] oMsg=new Object[3];
         oMsg[0] = ID;
         oMsg[1] = bText1;
         oMsg[2] = bText2;
         
         msg.setContentObject(oMsg);
     } catch (IOException ex) {
         System.err.println("Cannot add result to message. Sending empty message.");
         ex.printStackTrace(System.err);
     }
     
     a.send(msg);        
}
 
开发者ID:ayushoriginal,项目名称:Ngram-Graphs,代码行数:22,代码来源:ResultsAgent.java

示例3: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
/** Actually sends the result to the dispatching agent.
  */
 public void action() {
     synchronized (myAgent) {
         NGramDocumentComparatorAgent a = (NGramDocumentComparatorAgent)myAgent;
     
          // Send result before closing down
         ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
         msg.setSender(a.getAID());
         msg.addReceiver(a.ResultConsumer);
         try {
             msg.setContentObject(Result);
         } catch (IOException ex) {
             System.err.println("Cannot add result to message. Sending empty message.");
             ex.printStackTrace(System.err);
         }

         a.send(msg);
     }
     
}
 
开发者ID:ayushoriginal,项目名称:Ngram-Graphs,代码行数:22,代码来源:NGramDocumentComparatorAgent.java

示例4: processExecutionControlOntologyMsg

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
boolean processExecutionControlOntologyMsg() {
    ACLMessage m = receive(ts);
    if (m != null) {
        // send the agent state
        ACLMessage r = m.createReply();
        r.setPerformative(ACLMessage.INFORM);
        try {
            Document agStateDoc = jasonBridgeAgArch.getTS().getAg().getAgState();
            r.setContentObject((Serializable)agStateDoc);
            send(r);
        } catch (Exception e) {
            logger.log(Level.SEVERE, "Error sending message " + r, e);
        }
    }

    m = receive(tc);
    if (m != null) {
        int cycle = Integer.parseInt(m.getUserDefinedParameter("cycle"));
        logger.fine("new cycle: "+cycle);
        jasonBridgeAgArch.setCycleNumber(cycle);
        return true;
    }
    return false;
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:25,代码来源:JadeAgArch.java

示例5: action

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

	reply.setConversationId(Constance.GROUP_CREATED);
	
	try {
		reply.setContentObject(myAgent.getDict());
		System.out.println("set defautlistmodele of reply\n");
		myAgent.send(reply);
		System.out.println("multiAgent sent reply\n");
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:19,代码来源:GetListGameBehaviour.java

示例6: answer

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
public void answer(){
	
	ACLMessage reply=msg.createReply();
	
	reply.setPerformative(ACLMessage.INFORM);
	
	//String listString="";
	
	/*for(String s:myAgent.getDict()){
		listString+=s+",";
	}*/

	try {
		reply.setContentObject(myAgent.getDict());
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	
	myAgent.send(reply);
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:22,代码来源:GameManageBehaviour.java

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

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

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

示例12: addBlockToMessage

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
private static ACLMessage addBlockToMessage(ACLMessage message, Block block) {
	if (block == null) {
		message.setPerformative(ACLMessage.FAILURE);
		return message;
	}
	try {
		message.setContentObject(block);
	} catch (IOException e) {
		e.printStackTrace();
		message.setPerformative(ACLMessage.FAILURE);
		return message;
	}
	return message;
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:15,代码来源:FloorCommunicator.java

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

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

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


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