亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? agent.java

?? JADE(JAVA Agent開發框架)是一個完全由JAVA語言開發的軟件,它簡化了多Agent系統的實現。
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
			waitOn(suspendLock, 0);
		}
	}
	//#MIDP_EXCLUDE_END
	
	/**
	 This method adds a new behaviour to the agent. This behaviour
	 will be executed concurrently with all the others, using a
	 cooperative round robin scheduling.  This method is typically
	 called from an agent <code>setup()</code> to fire off some
	 initial behaviour, but can also be used to spawn new behaviours
	 dynamically.
	 @param b The new behaviour to add to the agent.
	 @see jade.core.Agent#setup()
	 @see jade.core.behaviours.Behaviour
	 */
	public void addBehaviour(Behaviour b) {
		b.setAgent(this);
		myScheduler.add(b);
	}
	
	/**
	 This method removes a given behaviour from the agent. This method
	 is called automatically when a top level behaviour terminates,
	 but can also be called from a behaviour to terminate itself or
	 some other behaviour.
	 @param b The behaviour to remove.
	 @see jade.core.behaviours.Behaviour
	 */
	public void removeBehaviour(Behaviour b) {
		myScheduler.remove(b);
		b.setAgent(null);
	}
	
	/**
	 Send an <b>ACL</b> message to another agent. This methods sends
	 a message to the agent specified in <code>:receiver</code>
	 message field (more than one agent can be specified as message
	 receiver).
	 @param msg An ACL message object containing the actual message to
	 send.
	 @see jade.lang.acl.ACLMessage
	 */
	public final void send(ACLMessage msg) {
		// Set the sender of the message if not yet set
		// FIXME. Probably we should always set the sender of the message!
		try {
			msg.getSender().getName().charAt(0);
		}
		catch (Exception e) {
			msg.setSender(myAID);
		}
		myToolkit.handleSend(msg, myAID, true);
	}
	
	/**
	 Receives an <b>ACL</b> message from the agent message
	 queue. This method is non-blocking and returns the first message
	 in the queue, if any. Therefore, polling and busy waiting is
	 required to wait for the next message sent using this method.
	 @return A new ACL message, or <code>null</code> if no message is
	 present.
	 @see jade.lang.acl.ACLMessage
	 */
	public final ACLMessage receive() {
		return receive(null);
	}
	
	/**
	 Receives an <b>ACL</b> message matching a given template. This
	 method is non-blocking and returns the first matching message in
	 the queue, if any. Therefore, polling and busy waiting is
	 required to wait for a specific kind of message using this method.
	 @param pattern A message template to match received messages
	 against.
	 @return A new ACL message matching the given template, or
	 <code>null</code> if no such message is present.
	 @see jade.lang.acl.ACLMessage
	 @see jade.lang.acl.MessageTemplate
	 */
	public final ACLMessage receive(MessageTemplate pattern) {
		ACLMessage msg = null;
		synchronized (msgQueue) {
			for (Iterator messages = msgQueue.iterator(); messages.hasNext(); ) {
				ACLMessage cursor = (ACLMessage)messages.next();
				if (pattern == null || pattern.match(cursor)) {
					msgQueue.remove(cursor);
					//#MIDP_EXCLUDE_BEGIN
					myToolkit.handleReceived(myAID, cursor);
					//#MIDP_EXCLUDE_END
					msg = cursor;
					break; // Exit while loop
				}
			}
		}
		return msg;
	}
	
	/**
	 Receives an <b>ACL</b> message from the agent message
	 queue. This method is blocking and suspends the whole agent until
	 a message is available in the queue. 
	 @return A new ACL message, blocking the agent until one is
	 available.
	 @see jade.core.Agent#receive()
	 @see jade.lang.acl.ACLMessage
	 */
	public final ACLMessage blockingReceive() {
		return blockingReceive(null, 0);
	}
	
	/**
	 Receives an <b>ACL</b> message from the agent message queue,
	 waiting at most a specified amount of time.
	 @param millis The maximum amount of time to wait for the message.
	 @return A new ACL message, or <code>null</code> if the specified
	 amount of time passes without any message reception.
	 */
	public final ACLMessage blockingReceive(long millis) {
		return blockingReceive(null, millis);
	}
	
	/**
	 Receives an <b>ACL</b> message matching a given message
	 template. This method is blocking and suspends the whole agent
	 until a message is available in the queue. 
	 @param pattern A message template to match received messages
	 against.
	 @return A new ACL message matching the given template, blocking
	 until such a message is available.
	 @see jade.core.Agent#receive(MessageTemplate)
	 @see jade.lang.acl.ACLMessage
	 @see jade.lang.acl.MessageTemplate
	 */
	public final ACLMessage blockingReceive(MessageTemplate pattern) {
		return blockingReceive(pattern, 0);
	}
	
	
	/**
	 Receives an <b>ACL</b> message matching a given message template,
	 waiting at most a specified time.
	 @param pattern A message template to match received messages
	 against.
	 @param millis The amount of time to wait for the message, in
	 milliseconds.
	 @return A new ACL message matching the given template, or
	 <code>null</code> if no suitable message was received within
	 <code>millis</code> milliseconds.
	 @see jade.core.Agent#blockingReceive()
	 */
	public final ACLMessage blockingReceive(MessageTemplate pattern, long millis) {
		ACLMessage msg = null;
		synchronized(msgQueue) {
			msg = receive(pattern);
			long timeToWait = millis;
			while(msg == null) {
				long startTime = System.currentTimeMillis();
				if (Thread.currentThread().equals(myThread)) {
					doWait(timeToWait);
				}
				else {
					// blockingReceive() called from an external thread --> Do not change the agent state
					waitUntilWake(timeToWait);
				}
				long elapsedTime = System.currentTimeMillis() - startTime;
				
				msg = receive(pattern);
				
				if(millis != 0) {
					timeToWait -= elapsedTime;
					if(timeToWait <= 0)
						break;
				}
			}
		}
		return msg;
	}
	
	/**
	 Puts a received <b>ACL</b> message back into the message
	 queue. This method can be used from an agent behaviour when it
	 realizes it read a message of interest for some other
	 behaviour. The message is put in front of the message queue, so
	 it will be the first returned by a <code>receive()</code> call.
	 @see jade.core.Agent#receive()
	 */
	public final void putBack(ACLMessage msg) {
		synchronized(msgQueue) {
			msgQueue.addFirst(msg);
		}
	}
	
	final void setToolkit(AgentToolkit at) {
		myToolkit = at;
	}
	
	final void resetToolkit() {
		//#MIDP_EXCLUDE_BEGIN
		myToolkit = DummyToolkit.instance();
		//#MIDP_EXCLUDE_END
		/*#MIDP_INCLUDE_BEGIN
		 myToolkit = null;
		 #MIDP_INCLUDE_END*/
	}
	
	
	//#MIDP_EXCLUDE_BEGIN
	//#APIDOC_EXCLUDE_BEGIN
	/**
	 This method blocks until the agent has finished its start-up phase
	 (i.e. until just before its setup() method is called.
	 When this method returns, the target agent is registered with the
	 AMS and the JADE platform is aware of it.
	 */
	public synchronized void waitUntilStarted() {
		while(myLifeCycle.getState() == AP_INITIATED) {
			try {
				wait();
			}
			catch(InterruptedException ie) {
				// Do nothing...
			}
		}
	}
	//#APIDOC_EXCLUDE_END
	
	
	// Notify creator that the start-up phase has completed
	private synchronized void notifyStarted() {
		notifyAll();
	}
	
	
	// Notify toolkit of the added behaviour
	// Package scooped as it is called by the Scheduler
	void notifyAddBehaviour(Behaviour b) {
		if (generateBehaviourEvents) {
			myToolkit.handleBehaviourAdded(myAID, b);
		}
	}
	
	// Notify the toolkit of the removed behaviour
	// Package scooped as it is called by the Scheduler
	void notifyRemoveBehaviour(Behaviour b) {
		if (generateBehaviourEvents) {
			myToolkit.handleBehaviourRemoved(myAID, b);
		}
	}
	
	
	//#APIDOC_EXCLUDE_BEGIN
	
	// Notify the toolkit of the change in behaviour state
	// Public as it is called by the Scheduler and by the Behaviour class 
	public void notifyChangeBehaviourState(Behaviour b, String from, String to) {
		b.setExecutionState(to);
		if (generateBehaviourEvents) {
			myToolkit.handleChangeBehaviourState(myAID, b, from, to);
		}
	}
	
	public void setGenerateBehaviourEvents(boolean b) {
		generateBehaviourEvents = b;
	}
	//#APIDOC_EXCLUDE_END
	
	
	// For persistence service
	private boolean getGenerateBehaviourEvents() {
		return generateBehaviourEvents;
	}
	
	
	// Notify toolkit that the current agent has changed its state
	private void notifyChangedAgentState(int oldState, int newState) {
		myToolkit.handleChangedAgentState(myAID, oldState, newState);
	}
	
	//#MIDP_EXCLUDE_END
	
	private void activateAllBehaviours() {
		myScheduler.restartAll();
	}
	
	/**
	 Put a received message into the agent message queue. The message
	 is put at the back end of the queue. This method is called by
	 JADE runtime system when a message arrives, but can also be used
	 by an agent, and is just the same as sending a message to oneself
	 (though slightly faster).
	 @param msg The ACL message to put in the queue.
	 @see jade.core.Agent#send(ACLMessage msg)
	 */
	public final void postMessage(final ACLMessage msg) {
		synchronized (msgQueue) {
			if (msg != null) {
				//#MIDP_EXCLUDE_BEGIN
				myToolkit.handlePosted(myAID, msg);
				//#MIDP_EXCLUDE_END
				msgQueue.addLast(msg);
				doWake();
				messageCounter++;
			}
		}
	}
	
	//#CUSTOM_EXCLUDE_BEGIN
	private jade.content.ContentManager theContentManager = null;
	
	/**
	 * Retrieves the agent's content manager 
	 * @return The content manager.
	 */
	public jade.content.ContentManager getContentManager() {
		if (theContentManager == null) {
			theContentManager = new jade.content.ContentManager();
		}
		return theContentManager;
	}
	
	// All the agent's service helper
	private transient Hashtable helpersTable;
	
	/**
	 * Retrieves the agent's service helper
	 * @return The service helper.
	 */
	public ServiceHelper getHelper( String serviceName ) throws ServiceException {
		ServiceHelper se = null;
		if (helpersTable == null) {
			helpersTable = new Hashtable();
		}
		
		se = (ServiceHelper) helpersTable.get(serviceName);
		// is the helper already into the agent's helpersTable ?
		if (se == null) {
			// there isn't, request its creation
			se = myToolkit.getHelper(this, serviceName);
			if (se != null) {
				se.init(this);
				helpersTable.put(serviceName, se);
			}
			else {
				throw new ServiceException("Null helper");
			}
		}
		return se;
	}
	//#CUSTOM_EXCLUDE_END
	
	/**
	 Retrieve a configuration property set in the <code>Profile</code>
	 of the local container (first) or as a System property.
	 @param key the key that maps to the property that has to be 
	 retrieved.
	 @param aDefault a default value to be returned if there is no mapping
	 for <code>key</code>
	 */
	public String getProperty(String key, String aDefault) {
		String val = myToolkit.getProperty(key, aDefault);
		if (val == null || val.equals(aDefault)) {
			// Try among the System properties
			String sval = System.getProperty(key);
			if (sval != null) {
				val = sval;
			}
		}
		return val;
	}
	
	
	/**
	 This method is used to interrupt the agent's thread.
	 In J2SE/PJAVA it just calls myThread.interrupt(). In MIDP, 
	 where interrupt() is not supported the thread interruption is 
	 simulated as described below.
	 The agent thread can be in one of the following three states:
	 1) Running a behaviour.
	 2) Sleeping on msgQueue due to a doWait()
	 3) Sleeping on myScheduler due to a schedule() with no active behaviours
	 Note that in MIDP the suspended state is not supported
	 The idea is: set the 'isInterrupted' flag, then wake up the
	 thread wherever it may be
	 */
	private void interruptThread() {
		//#MIDP_EXCLUDE_BEGIN
		myThread.interrupt();
		//#MIDP_EXCLUDE_END
		/*#MIDP_INCLUDE_BEGIN
		 synchronized (this) {
		 isInterrupted = true;
		 
		 // case 1: Nothing to do.
		  // case 2: Signal on msgQueue.
		   synchronized (msgQueue) {msgQueue.notifyAll();} 
		   // case 3: Signal on the Scheduler
		    synchronized (myScheduler) {myScheduler.notifyAll();}
		    }
		    #MIDP_INCLUDE_END*/
	} 
	
	/**
	 Since in MIDP Thread.interrupt() does not exist and a simulated
	 interruption is used to "interrupt" the agent's thread, we must 
	 check whether the simulated interruption happened just before and
	 after going to sleep.
	 */
	void waitOn(Object lock, long millis) throws InterruptedException {
		/*#MIDP_INCLUDE_BEGIN
		 synchronized (this) {
		 if (isInterrupted) {
		 isInterrupted = false;
		 throw new InterruptedException();
		 }
		 } 
		 #MIDP_INCLUDE_END*/
		lock.wait(millis);
		/*#MIDP_INCLUDE_BEGIN
		 synchronized (this) {
		 if (isInterrupted) {
		 isInterrupted = false;
		 throw new InterruptedException();
		 }
		 } 
		 #MIDP_INCLUDE_END*/
	}
	
	//#J2ME_EXCLUDE_BEGIN
	// For persistence service -- Hibernate needs java.util collections
	private java.util.Set getBehaviours() {
		Behaviour[] behaviours = myScheduler.getBehaviours();
		java.util.Set result = new java.util.HashSet();
		result.addAll(java.util.Arrays.asList(behaviour

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产69精品久久久久毛片| 日韩午夜小视频| 欧美一级日韩不卡播放免费| 久久久久久久性| 亚洲国产欧美一区二区三区丁香婷| 精品一区二区在线视频| 欧美亚洲一区二区三区四区| 国产日产亚洲精品系列| 日韩中文欧美在线| 91黄色免费看| 亚洲三级久久久| 国产高清精品网站| 精品理论电影在线| 日韩综合小视频| 欧洲av在线精品| 亚洲天堂av一区| 北条麻妃国产九九精品视频| 久久综合视频网| 蜜臀av性久久久久av蜜臀妖精| 欧美性猛交xxxx乱大交退制版 | 国产一区二区电影| 91精品国产aⅴ一区二区| 亚洲黄网站在线观看| 97精品电影院| 亚洲视频免费观看| 色乱码一区二区三区88| 亚洲欧美日韩在线| 在线精品亚洲一区二区不卡| 亚洲免费资源在线播放| 91社区在线播放| 亚洲免费成人av| 在线一区二区三区四区| 亚洲激情在线激情| 在线视频国内自拍亚洲视频| 亚洲精品视频一区二区| 91福利在线免费观看| 亚洲福利视频一区| 欧美一区二区三区的| 美女国产一区二区| 久久综合九色欧美综合狠狠| 国产麻豆一精品一av一免费| 欧美高清在线一区| 91网站在线播放| 亚洲影视资源网| 欧美一区二区高清| 国产一区二区三区高清播放| 国产视频一区在线观看| 99在线热播精品免费| 一区二区三区中文在线观看| 欧美亚洲综合一区| 蜜桃视频一区二区| 中文字幕第一页久久| 91免费看`日韩一区二区| 亚洲国产精品麻豆| 日韩精品一区二区三区中文不卡| 久久精品国产免费| 国产精品嫩草影院com| 色吊一区二区三区| 免费高清在线视频一区·| 国产日产亚洲精品系列| 在线观看中文字幕不卡| 精品一区免费av| 亚洲欧美电影院| 欧美一级片免费看| 成人久久18免费网站麻豆| 亚洲国产精品麻豆| 欧美国产日韩精品免费观看| 91国模大尺度私拍在线视频| 国内成人自拍视频| 亚洲精品亚洲人成人网| 欧美精品一区在线观看| 色狠狠桃花综合| 久久99国内精品| 亚洲精品你懂的| 精品粉嫩超白一线天av| 色又黄又爽网站www久久| 麻豆精品视频在线观看免费| 国产精品精品国产色婷婷| 日韩一级片在线观看| 91色在线porny| 国内外精品视频| 丝袜a∨在线一区二区三区不卡| 国产欧美日本一区二区三区| 欧美一区二区三区四区高清| 99久久精品国产观看| 国产综合久久久久影院| 亚洲尤物在线视频观看| 亚洲欧洲www| 久久久久国产精品人| 91精品国产色综合久久不卡蜜臀 | 国产一区二区在线免费观看| 亚洲色图一区二区三区| 国产三级精品在线| 日韩欧美国产小视频| 欧美视频三区在线播放| 色综合久久九月婷婷色综合| 国产精品一区二区视频| 久久精品国产精品亚洲精品| 亚洲高清免费观看| 亚洲午夜精品久久久久久久久| 国产精品情趣视频| 欧美不卡一区二区三区| 欧美一区二区三区影视| 欧美优质美女网站| 欧美亚洲国产怡红院影院| av电影在线观看完整版一区二区| 国产一区二区三区免费播放| 九色综合国产一区二区三区| 日本在线不卡一区| 天天操天天色综合| 亚洲成人一区二区在线观看| 亚洲午夜影视影院在线观看| 亚洲精品你懂的| 亚洲综合色丁香婷婷六月图片| 亚洲视频中文字幕| 一区二区三区欧美久久| 亚洲综合一区二区三区| 亚洲成人激情av| 日韩精品久久久久久| 久久国产人妖系列| 国内精品伊人久久久久av影院 | 免费在线成人网| 久久99精品久久久久久国产越南| 秋霞影院一区二区| 国内精品久久久久影院薰衣草| 国产另类ts人妖一区二区| 国产精品911| 97精品久久久午夜一区二区三区| 色婷婷av一区二区三区软件 | 91小宝寻花一区二区三区| 色婷婷激情久久| 3atv在线一区二区三区| 欧美成人一级视频| 国产精品国产馆在线真实露脸| 中文字幕一区二区三区四区| 亚洲国产你懂的| 精品影院一区二区久久久| www.久久精品| 欧美疯狂性受xxxxx喷水图片| 91精品国产综合久久婷婷香蕉 | 欧美一区二区在线免费观看| 精品久久久三级丝袜| 国产精品国产三级国产aⅴ入口 | 成人精品免费网站| 欧美午夜精品理论片a级按摩| 精品久久久久久久人人人人传媒| 欧美激情综合网| 首页国产丝袜综合| 国产激情视频一区二区三区欧美| 91久久精品国产91性色tv| 日韩一区二区电影在线| 亚洲欧洲日韩在线| 美洲天堂一区二卡三卡四卡视频| 成人激情动漫在线观看| 91精品国产欧美一区二区18| 国产精品免费网站在线观看| 亚洲成人免费影院| 成人黄色小视频在线观看| 欧美一区二区三区在线观看 | 国内欧美视频一区二区 | 亚洲成av人片一区二区三区| 黄色日韩三级电影| 欧美在线免费播放| 欧美韩日一区二区三区四区| 亚洲国产精品欧美一二99| 成人激情校园春色| 日韩精品一区二区三区蜜臀 | 欧美日韩一卡二卡三卡| 国产欧美日韩三区| 久久99久久久久久久久久久| 在线观看成人免费视频| 国产精品伦理一区二区| 久久国产婷婷国产香蕉| 欧美乱妇15p| 亚洲伦在线观看| 国产a视频精品免费观看| 精品乱人伦小说| 青青草伊人久久| 欧美猛男男办公室激情| 一区二区视频在线| 99国产精品久久| 中文字幕高清一区| 国产精品资源网| 久久久久久影视| 激情小说亚洲一区| 欧美mv和日韩mv国产网站| 人禽交欧美网站| 日韩女优电影在线观看| 午夜精品免费在线| 欧美视频三区在线播放| 亚洲成av人片www| 欧美在线999| 亚洲动漫第一页| 69av一区二区三区| 日韩有码一区二区三区| 欧美日韩国产天堂| 日韩精品一级中文字幕精品视频免费观看 | 91久久精品网| 亚洲无线码一区二区三区| 欧美亚洲综合一区|