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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? agent.java

?? JADE(JAVA Agent開發(fā)框架)是一個(gè)完全由JAVA語言開發(fā)的軟件,它簡化了多Agent系統(tǒng)的實(shí)現(xiàn)。
?? JAVA
?? 第 1 頁 / 共 5 頁
字號(hào):
	 @see jade.core.Agent#setEnabledO2ACommunication(boolean enabled, int queueSize)
	 */
	public Object getO2AObject() {
		
		// Return 'null' if object-to-agent communication is disabled
		if(o2aQueue == null)
			return null;
		
		CondVar cond = null;
		Object result = null;
		synchronized (o2aQueue) {
			if(o2aQueue.isEmpty())
				return null;
			
			// Retrieve the first object from the object-to-agent
			// communication queue
			result = o2aQueue.remove(0);
			
			// If some thread issued a blocking putO2AObject() call with this
			// object, wake it up. cond.set is synchronized on CondVar object
			cond = (CondVar)o2aLocks.remove(result);
		}
		
		if(cond != null) {
			cond.set();
		}
		
		return result;
		
	}
	
	
	/**
	 This method declares this agent attitude towards object-to-agent
	 communication, that is, whether the agent accepts to communicate
	 with other non-JADE components living within the same JVM.
	 <br>
	 <b>NOT available in MIDP</b>
	 <br>
	 @param enabled Tells whether Java objects inserted with
	 <code>putO2AObject()</code> will be accepted.
	 @param queueSize If the object-to-agent communication is enabled,
	 this parameter specifiies the maximum number of Java objects that
	 will be queued. If the passed value is 0, no maximum limit is set
	 up for the queue.
	 
	 @see jade.wrapper.Agent#putO2AObject(Object o, boolean blocking)
	 @see jade.core.Agent#getO2AObject()
	 
	 */
	public void setEnabledO2ACommunication(boolean enabled, int queueSize) {
		if(enabled) {
			if(o2aQueue == null)
				o2aQueue = new ArrayList(queueSize);
			
			// Ignore a negative value
			if(queueSize >= 0)
				o2aQueueSize = queueSize;
		}
		else {
			
			// Wake up all threads blocked in putO2AObject() calls
			Iterator it = o2aLocks.values().iterator();
			while(it.hasNext()) {
				CondVar cv = (CondVar)it.next();
				if (cv != null) cv.set();
			}
			
			o2aQueue = null;
		}
		
	}
	//#MIDP_EXCLUDE_END
	
	
	//#APIDOC_EXCLUDE_BEGIN
	
	/**
	 This method is the main body of every agent. It 
	 provides startup and cleanup hooks for application 
	 programmers to put their specific code into.
	 @see jade.core.Agent#setup()
	 @see jade.core.Agent#takeDown()
	 */
	public final void run() {
		try {
			myLifeCycle.init();
			while (myLifeCycle.alive()) {
				try {
					myLifeCycle.execute();
					// Let other agents go on
					Thread.yield();
				}
				catch (JADESecurityException jse) {
					// FIXME: maybe we should send a message to the agent
					System.out.println("JADESecurityException: "+jse.getMessage());
				}
				catch (InterruptedException ie) {
					// Change LC state request from the outside. Just do nothing
					// and let the new LC state do its job
				}
				catch (InterruptedIOException ie) {
					// Change LC state request from the outside. Just do nothing
					// and let the new LC state do its job
				}
				catch (Interrupted i) {
					// Change LC state request from the outside. Just do nothing
					// and let the new LC state do its job
				}
			}
		}
		catch(Throwable t) {
			System.err.println("***  Uncaught Exception for agent " + myName + "  ***");
			t.printStackTrace();
		}
		terminating = true;
		myLifeCycle.end();
	}		
	//#APIDOC_EXCLUDE_END
	
	
	
	/**
	 Inner class ActiveLifeCycle
	 */
	private class ActiveLifeCycle extends LifeCycle {
		private static final long serialVersionUID = 11111;
		private ActiveLifeCycle() {
			super(AP_INITIATED);
		}
		
		public void setState(int s) {
			myState = s;
		}
		
		public void init() {
			setActiveState(AP_ACTIVE);
			//#MIDP_EXCLUDE_BEGIN
			notifyStarted();
			//#MIDP_EXCLUDE_END
			setup();
			restarting = false;
		}
		
		public void execute() throws JADESecurityException, InterruptedException, InterruptedIOException {
			// Select the next behaviour to execute
			Behaviour currentBehaviour = myScheduler.schedule();
			// Remember how many messages arrived
			int oldMsgCounter = messageCounter;
			
			// Just do it!
			currentBehaviour.actionWrapper();
			
			// If the current Behaviour has blocked and more messages arrived
			// in the meanwhile, restart the behaviour to give it another chance
			if((oldMsgCounter != messageCounter) && (!currentBehaviour.isRunnable())) {
				currentBehaviour.restart();
			}
			
			// When it is needed no more, delete it from the behaviours queue
			if(currentBehaviour.done()) {
				currentBehaviour.onEnd();
				myScheduler.remove(currentBehaviour);
				currentBehaviour = null;
			}
			else {
				synchronized(myScheduler) {
					// Need synchronized block (Crais Sayers, HP): What if
					// 1) it checks to see if its runnable, sees its not,
					//    so it begins to enter the body of the if clause
					// 2) meanwhile, in another thread, a message arrives, so
					//    the behaviour is restarted and moved to the ready list.
					// 3) now back in the first thread, the agent executes the
					//    body of the if clause and, by calling block(), moves
					//   the behaviour back to the blocked list.
					if(!currentBehaviour.isRunnable()) {
						// Remove blocked behaviour from ready behaviours queue
						// and put it in blocked behaviours queue
						myScheduler.block(currentBehaviour);
						currentBehaviour = null;
					}
				}
			}
		}
		
		public void end() {
			clean(false);
		}
		
		public boolean transitionTo(LifeCycle to) {
			// We can go to whatever state unless we are terminating
			if (!terminating) {
				// The agent is going to leave this state. When 
				// the agent will enter this state again it must be 
				// in AP_ACTIVE
				myState = AP_ACTIVE;
				return true;
			}
			else {
				return false;
			}
		}
		
		public void transitionFrom(LifeCycle from) {
			activateAllBehaviours();
		}
		
		public boolean isMessageAware() {
			return true;
		}
	} // END of inner class ActiveLifeCycle
	
	
	/**
	 Inner class DeletedLifeCycle
	 */
	private class DeletedLifeCycle extends LifeCycle {
		private static final long serialVersionUID = 11112;
		private DeletedLifeCycle() {
			super(AP_DELETED);
		}
		
		public void end() {
			clean(true);
		}
		
		public boolean alive() {
			return false;
		}		
	} // END of inner class DeletedLifeCycle
	
	//#MIDP_EXCLUDE_BEGIN
	/**
	 Inner class SuspendedLifeCycle
	 */
	private class SuspendedLifeCycle extends LifeCycle {
		private static final long serialVersionUID = 11113;
		private SuspendedLifeCycle() {
			super(AP_SUSPENDED);
		}
		
		public void execute() throws JADESecurityException, InterruptedException, InterruptedIOException {
			waitUntilActivate();
		}
		
		public void end() {
			clean(false);
		}
		
		public boolean transitionTo(LifeCycle to) {
			// We can only die or resume
			return (to.getState() == AP_ACTIVE || to.getState() == AP_DELETED); 
		}		
	} // END of inner class SuspendedLifeCycle
	
	//#MIDP_EXCLUDE_END
	
	
	//#APIDOC_EXCLUDE_BEGIN
	public void clean(boolean ok) {
		if (!ok) {
			System.out.println("ERROR: Agent " + myName + " died without being properly terminated !!!");
			System.out.println("State was " + myLifeCycle.getState());
		}
		//#MIDP_EXCLUDE_BEGIN
		// Reset the interrupted state of the Agent Thread
		Thread.interrupted();
		//#MIDP_EXCLUDE_END
		
		myBufferedLifeCycle = myLifeCycle;
		myLifeCycle = myActiveLifeCycle;
		takeDown();
		pendingTimers.clear();
		myToolkit.handleEnd(myAID);
		myLifeCycle = myBufferedLifeCycle;
	}
	//#APIDOC_EXCLUDE_END
	
	/**
	 This protected method is an empty placeholder for application
	 specific startup code. Agent developers can override it to
	 provide necessary behaviour. When this method is called the agent
	 has been already registered with the Agent Platform <b>AMS</b>
	 and is able to send and receive messages. However, the agent
	 execution model is still sequential and no behaviour scheduling
	 is active yet.
	 
	 This method can be used for ordinary startup tasks such as
	 <b>DF</b> registration, but is essential to add at least a
	 <code>Behaviour</code> object to the agent, in order for it to be
	 able to do anything.
	 @see jade.core.Agent#addBehaviour(Behaviour b)
	 @see jade.core.behaviours.Behaviour
	 */
	protected void setup() {}
	
	/**
	 This protected method is an empty placeholder for application
	 specific cleanup code. Agent developers can override it to
	 provide necessary behaviour. When this method is called the agent
	 has not deregistered itself with the Agent Platform <b>AMS</b>
	 and is still able to exchange messages with other
	 agents. However, no behaviour scheduling is active anymore and
	 the Agent Platform Life Cycle state is already set to
	 <em>deleted</em>.
	 
	 This method can be used for ordinary cleanup tasks such as
	 <b>DF</b> deregistration, but explicit removal of all agent
	 behaviours is not needed.
	 */
	protected void takeDown() {}
	
	//#MIDP_EXCLUDE_BEGIN
	/**
	 * This empty placeholder shall be overridden by user defined agents 
	 * to execute some actions before the original agent instance on the 
	 * source container is stopped (e.g. releasing local resources such 
	 * as a GUI).<br>
	 * <b>IMPORTANT:</b> At this point, it is ensured that the move process
	 * is successful and that a moved agent instance has been created on the 
	 * destination container 
	 * Therefore setting the value of a class field in this method will have
	 * no impact on the moved agent instance. Such parameters must indeed be 
	 * set <b>before</b> the <code>doMove()</code> method is called.
	 <br>
	 <b>NOT available in MIDP</b>
	 <br>
	 */
	protected void beforeMove() {}
	
	/**
	 Actions to perform after moving. This empty placeholder method can be
	 overridden by user defined agents to execute some actions just after
	 arriving to the destination agent container for a migration.
	 <br>
	 <b>NOT available in MIDP</b>
	 <br>
	 */
	protected void afterMove() {}
	
	/**
	 * This empty placeholder method shall be overridden by user defined agents 
	 * to execute some actions before copying an agent to another agent container.
	 * <br>
	 * <b>NOT available in MIDP</b>
	 * <br>
	 * @see beforeMove()
	 * @see afterClone()
	 */
	protected void beforeClone() {}
	
	/**
	 Actions to perform after cloning. This empty placeholder method can be
	 overridden by user defined agents to execute some actions just after
	 creating an agent copy to the destination agent container.
	 <br>
	 <b>NOT available in MIDP</b>
	 <br>
	 */
	protected void afterClone() {}
	//#MIDP_EXCLUDE_END
	
	// This method is used by the Agent Container to fire up a new agent for the first time
	// Mutual exclusion with itself and Agent.addPlatformAddress()
	synchronized void powerUp(AID id, Thread t) {
		if (myThread == null) {
			// Set this agent's name and address and start its embedded thread
			myName = id.getLocalName();
			myHap = id.getHap();
			
			myAID = id;
			myToolkit.setPlatformAddresses(myAID);
			
			myThread = t;
			myThread.start();
		}
	}
	
	//#J2ME_EXCLUDE_BEGIN
	// Return agent thread
	// Package scooped as it is called by JadeMisc add-on for container monitor purpose
	Thread getThread() {
		return myThread;
	}
	//#J2ME_EXCLUDE_END
	
	//#MIDP_EXCLUDE_BEGIN
	private void writeObject(ObjectOutputStream out) throws IOException {
		// Updates the queue maximum size field, before serialising
		msgQueueMaxSize = msgQueue.getMaxSize();
		
		out.defaultWriteObject();
	}
	
	private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
		in.defaultReadObject();
		
		// Restore transient fields (apart from myThread, which will be set when the agent will be powered up)
		msgQueue = new MessageQueue(msgQueueMaxSize);
		stateLock = new Object();
		suspendLock = new Object();
		pendingTimers = new AssociationTB();
		theDispatcher = TimerDispatcher.getTimerDispatcher();
		// restore O2AQueue
		if (o2aQueueSize > 0) 
			o2aQueue = new ArrayList(o2aQueueSize);
		o2aLocks = new HashMap();
		myToolkit = DummyToolkit.instance();
		
		//#PJAVA_EXCLUDE_BEGIN
		//For persistence service
		persistentPendingTimers = new java.util.HashSet();
		//#PJAVA_EXCLUDE_END
	}
	//#MIDP_EXCLUDE_END
	
	
	/**
	 This method is executed when blockingReceive() is called
	 from a separate Thread. 
	 It does not affect the agent state.
	 */
	private void waitUntilWake(long millis) {
		synchronized(msgQueue) {
			try {
				// Blocks on msgQueue monitor for a while
				waitOn(msgQueue, millis);
			}
			catch (InterruptedException ie) {
				throw new Interrupted();
			}
		}
	}
	
	//#MIDP_EXCLUDE_BEGIN
	private void waitUntilActivate() throws InterruptedException {
		synchronized(suspendLock) {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区视频在线观看| 制服丝袜亚洲色图| 亚洲一区二区三区免费视频| 91精品国产麻豆国产自产在线| 国产一区999| 亚洲国产精品久久久久秋霞影院 | 岛国一区二区三区| 亚洲成人av一区二区三区| 国产日韩一级二级三级| 欧美一区二区黄色| 欧美视频在线观看一区| 福利一区二区在线观看| 极品瑜伽女神91| 三级欧美韩日大片在线看| 亚洲欧美激情小说另类| 久久久九九九九| 日韩精品一区二区三区视频播放 | 国产乱码精品一区二区三区av | 一区二区三区久久| 欧美国产成人在线| 2021久久国产精品不只是精品| 精品视频一区 二区 三区| 99久久综合色| 成人国产亚洲欧美成人综合网| 久久aⅴ国产欧美74aaa| 美女视频网站久久| 亚洲第一精品在线| 亚洲成人先锋电影| 调教+趴+乳夹+国产+精品| 亚洲综合免费观看高清在线观看| 国产视频在线观看一区二区三区| 精品国产成人在线影院 | 91黄色免费版| 91网站最新地址| 97aⅴ精品视频一二三区| 成人国产精品免费网站| 国产·精品毛片| 成人黄色av电影| 99久久伊人精品| 91麻豆精品在线观看| www.日韩在线| 色综合av在线| 欧美在线你懂得| 欧美猛男gaygay网站| 欧美美女喷水视频| 亚洲一区二区黄色| 亚洲最快最全在线视频| 亚洲一区二区视频在线| 日韩中文字幕一区二区三区| 蜜臀91精品一区二区三区| 美日韩一区二区三区| 韩国av一区二区三区四区| 国产一区二区伦理片| 成人午夜视频在线观看| 99久久婷婷国产| 欧美日韩黄视频| 欧美一区二区三区啪啪| wwwwww.欧美系列| 中文字幕一区二区三区在线播放 | 国产精品123| av一本久道久久综合久久鬼色| 99精品欧美一区| 欧美日本不卡视频| 欧美tk—视频vk| 国产精品盗摄一区二区三区| 又紧又大又爽精品一区二区| 日韩av不卡一区二区| 国产一区二区三区蝌蚪| 99久久精品国产一区| 欧美精品v日韩精品v韩国精品v| 日韩一区二区三区电影在线观看| 久久久综合精品| 亚洲三级免费电影| 日韩电影在线看| 丰满少妇久久久久久久| 色婷婷综合久久久久中文一区二区| 9191精品国产综合久久久久久| 欧美大尺度电影在线| 中文字幕一区二区三区在线不卡| 丝袜美腿一区二区三区| 风间由美一区二区av101| 欧美卡1卡2卡| 中文成人av在线| 日本午夜一本久久久综合| 丰满少妇久久久久久久| 在线不卡欧美精品一区二区三区| 久久精品人人做| 亚洲大片在线观看| 大胆亚洲人体视频| 欧美精品一级二级三级| 国产欧美一区二区精品性| 午夜精品一区二区三区三上悠亚| 国产原创一区二区| 欧美日韩免费观看一区三区| 久久精品视频在线看| 婷婷开心久久网| 色94色欧美sute亚洲线路一久 | 亚洲欧洲综合另类| 国产一区二区三区不卡在线观看 | 欧美性感一区二区三区| 中文字幕免费不卡在线| 青青草国产成人av片免费| 色94色欧美sute亚洲线路一ni | 亚洲在线视频网站| 国产成人福利片| 日韩午夜激情视频| 午夜久久久久久久久久一区二区| 不卡的看片网站| 久久久亚洲欧洲日产国码αv| 午夜精品久久久久| 91视频精品在这里| 国产精品国产成人国产三级 | 玉米视频成人免费看| 不卡视频一二三四| 国产午夜精品福利| 美国十次综合导航| 91麻豆精品国产91久久久久久久久 | 激情文学综合丁香| 欧美精品色综合| 亚洲亚洲人成综合网络| 99久久精品99国产精品| 欧美激情一区不卡| 国产成人综合在线观看| 精品久久久久久久久久久院品网 | 国产在线国偷精品产拍免费yy| 欧美日韩一区二区三区在线看 | 国产麻豆91精品| 久久久99久久精品欧美| 卡一卡二国产精品 | 国产尤物一区二区| 欧美va日韩va| 国内一区二区在线| 久久综合色综合88| 国产自产高清不卡| 久久伊99综合婷婷久久伊| 久久se这里有精品| 久久久久青草大香线综合精品| 国模一区二区三区白浆| 精品国免费一区二区三区| 美女高潮久久久| 日韩欧美一区中文| 捆绑调教美女网站视频一区| 欧美一区二区三区思思人| 日韩黄色片在线观看| 91精品麻豆日日躁夜夜躁| 日本三级亚洲精品| 精品久久久久久亚洲综合网 | 国产成人综合视频| 国产精品热久久久久夜色精品三区| 丁香婷婷综合五月| 中文字幕中文在线不卡住| 色哟哟国产精品| 午夜影院久久久| 精品久久久网站| 成人自拍视频在线观看| 亚洲免费在线播放| 欧美老女人第四色| 国产一区二区导航在线播放| 欧美一区二区三区白人| 国产麻豆精品久久一二三| 国产精品久久久久久亚洲毛片| 色欧美片视频在线观看 | 久久97超碰色| 中文字幕av一区二区三区免费看| 91在线视频在线| 日韩av电影天堂| 久久精品视频网| 欧美网站大全在线观看| 久久精品国产网站| 国产精品色一区二区三区| 欧美色爱综合网| 黄色精品一二区| 亚洲精品乱码久久久久久| 91精品国产一区二区| 国产精品自在在线| 亚洲一区二区三区中文字幕在线| 日韩一区二区电影在线| 99久久久免费精品国产一区二区| 香蕉久久一区二区不卡无毒影院| 久久精品一区二区三区不卡| 91美女片黄在线观看91美女| 美女诱惑一区二区| 亚洲色图欧美激情| 精品欧美一区二区久久| 一本到不卡精品视频在线观看| 麻豆一区二区99久久久久| 综合av第一页| 久久综合网色—综合色88| 欧美在线999| 懂色av中文字幕一区二区三区| 丝袜美腿亚洲综合| 亚洲视频一区在线观看| 日韩欧美一区二区免费| 色综合久久久久久久久| 国产一区二区三区精品欧美日韩一区二区三区 | 国产片一区二区| 91精品国产综合久久国产大片| 国产成人午夜电影网| 日韩成人免费看| 伊人色综合久久天天|