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


Java ACLMessage.getContentObject方法代码示例

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


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

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

示例2: handleServiceTypeRequest

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public ACLMessage handleServiceTypeRequest(ACLMessage serviceTypeRequest) {
	Block block;
	try {
		block = (Block) serviceTypeRequest.getContentObject();
		if (block != null) {
			goalPalette.giveBlock(block);
			return informMessage(serviceTypeRequest);
		} else {
			return failureMessage(serviceTypeRequest);
		}
	} catch (StationException | UnreadableException e) {
		e.printStackTrace();
		return failureMessage(serviceTypeRequest);
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:17,代码来源:GoalPaletteCommunicator.java

示例3: takeBlockTest

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Ignore
@Test	
public void takeBlockTest() {
	sourcePalette = new SourcePalette(0, 10);
	communicator = new SourcePaletteCommunicator(sourcePalette);
	ACLMessage reply = communicator.handleServiceTypeRequest(takeBlockMessage());
	assertTrue(reply.getPerformative() == ACLMessage.INFORM);
	assertTrue(this.sourcePalette.getBlocks().size() == 10);
	Block block = null;
	try {
		block = (Block) reply.getContentObject();
	} catch (UnreadableException e) {
		fail();
		e.printStackTrace();
	}
	assertTrue(block.Status.equals(Block.possibleBlockStatus.DIRTY));
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:18,代码来源:SourcePaletteCommunicatorTest.java

示例4: action

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public void action() {
	
	ACLMessage msg = myAgent.receive();			
	if (msg!=null) {
		
		AID sender = msg.getSender();
		
		// ---- extract content -----------------------------
		Object msgContent = null;
		try {
			msgContent = msg.getContentObject();
		} catch (UnreadableException e) {
			msgContent = null;
		}
		
		localEnvModelNew.put(sender.getLocalName(), (Integer) msgContent);
		if (localEnvModelNew.size()==localEnvModel.size()) {
			
			gui.updateGUI(localEnvModelNew);
			localEnvModel = localEnvModelNew;
			localEnvModelNew = new HashMap<String, Integer>();
			
			if (gui.slider.getValue()>0) {
				myAgent.doWait(gui.slider.getValue());
			}
			
			// --- Den n�chsten Schritt ausf�hren ----
			myAgent.addBehaviour(new StepBehaviour());
		}
		
	}
	else {
		block();
	}			
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:37,代码来源:SimulationManagerAgent.java

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

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

示例7: receiveRobotState

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public RobotState receiveRobotState() {
	ACLMessage robotStateMessage = this.trackAgent.blockingReceive(
			MessageTemplate.MatchProtocol(ProtocolTemplates.TrackProtocolTemplate.TRACK_ROBOT_STATE_PROTOCOL));
	RobotState state = null;
	try {
		state = (RobotState) robotStateMessage.getContentObject();
	} catch (UnreadableException e) {
		e.printStackTrace();
	}
	return state;
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:13,代码来源:TrackCommunicator.java

示例8: receiveFloor

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public Floor receiveFloor() {
	ACLMessage floorMessage = this.trackAgent.blockingReceive(
			MessageTemplate.MatchProtocol(ProtocolTemplates.TrackProtocolTemplate.TRACK_FLOOR_PROTOCOL));
	Floor floorState = null;
	try {
		floorState = (Floor) floorMessage.getContentObject();
	} catch (UnreadableException e) {
		e.printStackTrace();
	}
	return floorState;
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:13,代码来源:TrackCommunicator.java

示例9: receivePalette

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
@Override
public Palette receivePalette() {
	ACLMessage paletteMessage = this.trackAgent.blockingReceive(
			MessageTemplate.MatchProtocol(ProtocolTemplates.TrackProtocolTemplate.TRACK_PALETTE_PROTOCOL));
	Palette paletteState = null;
	try{
		paletteState = (Palette) paletteMessage.getContentObject();
	} catch (UnreadableException e){
		e.printStackTrace();
	}
	return paletteState;
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:13,代码来源:TrackCommunicator.java

示例10: unwrapPayload

import jade.lang.acl.ACLMessage; //导入方法依赖的package包/类
public static <T extends Serializable> T unwrapPayload(ACLMessage msg, Class<T> type) {
	try {
		final Serializable payload = msg.getContentObject();
		if (payload == null) {
			return null;
		} else if (type.isAssignableFrom(payload.getClass())) {
			return type.cast(payload);
		}
	} catch (UnreadableException e) {
		LOG.error("Unwrapping message payload failed.", e);
	}
	return null;
}
 
开发者ID:overheadhunter,项目名称:jade-factory,代码行数:14,代码来源:MessageUtil.java


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