• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UnreadableException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jade.lang.acl.UnreadableException的典型用法代码示例。如果您正苦于以下问题:Java UnreadableException类的具体用法?Java UnreadableException怎么用?Java UnreadableException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnreadableException类属于jade.lang.acl包,在下文中一共展示了UnreadableException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: moveAndgetBlockFromSourcePalette

import jade.lang.acl.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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.UnreadableException; //导入依赖的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: action

import jade.lang.acl.UnreadableException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void action() {
	if(first){
		ACLMessage multiPlayRegister = new ACLMessage(ACLMessage.SUBSCRIBE);
		multiPlayRegister.setConversationId("register");
		multiPlayRegister.setSender(myAgent.getAID());
		multiPlayRegister.addReceiver(myAgent.getServerName());
		multiPlayRegister.setContent("getting in");
		myAgent.send(multiPlayRegister);
		first = false;
	}
	
	if(!myAgent.isMultiple_mode()){
			ACLMessage multiPlayUnregister = new ACLMessage(ACLMessage.SUBSCRIBE);
			multiPlayUnregister.setConversationId("unregister");
			multiPlayUnregister.setSender(myAgent.getAID());
			multiPlayUnregister.addReceiver(myAgent.getServerName());
			multiPlayUnregister.setContent("getting out");
			myAgent.send(multiPlayUnregister);
			
			done=true;
	}
	
	MessageTemplate mt = 
			MessageTemplate.and(MessageTemplate.MatchConversationId("updateDICT"),
								MessageTemplate.MatchPerformative(ACLMessage.INFORM));
	ACLMessage update_message = myAgent.receive(mt);
	if(update_message!=null){
		System.out.println("receive update dict");
		if(update_message.getPerformative()==ACLMessage.INFORM){
			try {
				 myAgent.setDict((DefaultListModel<String>)update_message.getContentObject());
			} catch (UnreadableException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:41,代码来源:MultiPlayUpdateBehaviour.java


示例11: unwrapPayload

import jade.lang.acl.UnreadableException; //导入依赖的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


示例12: printMessage

import jade.lang.acl.UnreadableException; //导入依赖的package包/类
public static String printMessage(ACLMessage msg)
{
	String ret = "";
	String receivers = "";
	for(@SuppressWarnings("unchecked") Iterator<AID> it = msg.getAllReceiver(); it.hasNext();)
		receivers += ((receivers.length() > 0) ? ";" : "") + it.next().toString();
	try
	{
		ret += "[from:" + msg.getSender().getLocalName() + "][to:" + receivers + "][" + msg.getOntology() + "][" + msg.getProtocol() + "][" + ((msg.getContentObject() != null) ? msg.getContentObject().toString() : "-") + "]";
	} catch(UnreadableException e)
	{
		ret += "[from:" + msg.getSender().getLocalName() + "][" + msg.getOntology() + "][" + msg.getProtocol() + "][" + "#unreadable#" + "]";
	}
	return ret;
}
 
开发者ID:tATAmI-Project,项目名称:tATAmI-PC,代码行数:16,代码来源:ClaimMessage.java


示例13: action

import jade.lang.acl.UnreadableException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void action() {
	MessageTemplate mt = MessageTemplate.or(
											MessageTemplate.and(
																MessageTemplate.and(
																					MessageTemplate.MatchPerformative(ACLMessage.CONFIRM), 
																					MessageTemplate.MatchConversationId(myAgent.getRoomId())), 
																(MessageTemplate.or(MessageTemplate.MatchContent(Constance.CONFIRM_START), 
																		MessageTemplate.MatchContent(Constance.Sound_Change)))),
											MessageTemplate.and(
																MessageTemplate.MatchPerformative(ACLMessage.INFORM),
																MessageTemplate.or(
																					MessageTemplate.MatchConversationId(Constance.MEMBER_CHANGE),
																					MessageTemplate.MatchConversationId("StartVisibility"))));
	ACLMessage message= myAgent.receive(mt);

	if(message!=null){
		if (message.getPerformative() == ACLMessage.INFORM) {
			if(message.getConversationId().equals("StartVisibility")){
				if(message.getContent().equals("true")){
					myAgent.changeStartVisibility(true);
				}
			}else{
				try {
					myAgent.setDictPlayer((DefaultListModel<String>)message.getContentObject());
					if (!myAgent.getDictPlayer().contains(myAgent.getName())) {
						System.out.println("Agent name not found after member change, localGameBehaviour done");
						done = true;
					}
				} catch (UnreadableException e) {
					e.printStackTrace();
				}
			}
		} else if(message.getPerformative() == ACLMessage.CONFIRM){
			if(message.getContent().equals(Constance.Sound_Change)) {
				myAgent.setHostSoundName(MyAID.toAID(message.getReplyWith()));
				System.out.println("my local name is " + myAgent.getLocalName());
				System.out.println("sound play agent change to "+ MyAID.toAID(message.getReplyWith()));
			} else if (message.getContent().equals(Constance.CONFIRM_START)) {
				myAgent.setHostSoundName(MyAID.toAID(message.getReplyWith()));
				myAgent.changeToGameView();
			}
		}
	}
	
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:48,代码来源:LocalGameDaemonBehaviour.java


示例14: action

import jade.lang.acl.UnreadableException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void action() {
	if (first_run) {
		AID server_name = myAgent.getServerName();
		if(server_name !=null){
			msg.addReceiver(server_name);
			msg.setContent("listGroup");
			myAgent.send(msg);
			System.out.println("getlistgroupbehaviour envoie demande au multiAgent\n");
			first_run = false;
		} else {
			System.out.println("server not found, retry...");
		}
	} else {

		MessageTemplate mt = MessageTemplate.and(MessageTemplate.MatchPerformative(ACLMessage.INFORM), 
				MessageTemplate.MatchConversationId(Constance.GROUP_CREATED));
		ACLMessage message= myAgent.receive(mt);

		if(message!=null){
			/*String[] list=message.getContent().split(",");
			DefaultListModel<String> dict=new DefaultListModel<String>();
			
			for(String s:list){
				dict.addElement(s);
			}*/
			
			//myAgent.setDict(dict);
			System.out.println("userAgent recu et refresh list\n");
			try {
				myAgent.setDict((DefaultListModel<String>)message.getContentObject());
				//myAgent.getRoom_view().getList_room().setModel((DefaultListModel<String>) message.getContentObject());
				done = true;
			} catch (UnreadableException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
		
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:44,代码来源:GetListGroupBehaviour.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SearchScrollRequestBuilder类代码示例发布时间:2022-05-22
下一篇:
Java SynchronizedStmt类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap