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

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

?? agent.java

?? JADE(JAVA Agent開發框架)是一個完全由JAVA語言開發的軟件,它簡化了多Agent系統的實現。
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
	/**
	 Represents the <em>suspended</em> agent state.
	 */
	public static final int D_SUSPENDED = 20;
	
	/**
	 Represents the <em>retired</em> agent state.
	 */
	public static final int D_RETIRED = 30;
	
	/**
	 Represents the <em>unknown</em> agent state.
	 */
	public static final int D_UNKNOWN = 40;
	
	/**
	 Out of band value for Domain Life Cycle states.
	 */
	public static final int D_MAX = 41;    // Hand-made type checking
	//#MIDP_EXCLUDE_END
	//#APIDOC_EXCLUDE_END
	
	
	private transient MessageQueue msgQueue;
	private transient AgentToolkit myToolkit;
	//#MIDP_EXCLUDE_BEGIN
	private int       msgQueueMaxSize = 0;
	private transient List o2aQueue;
	private int o2aQueueSize = 0;
	private transient Map o2aLocks;
	private transient Object suspendLock;
	//#MIDP_EXCLUDE_END
	
	private String myName = null;  
	private AID myAID = null;
	private String myHap = null;
	
	private transient Object stateLock;
	
	private transient Thread myThread;
	private transient TimerDispatcher theDispatcher;
	
	private Scheduler myScheduler;
	
	private transient AssociationTB pendingTimers;
	
	// Free running counter that increments by one for each message
	// received.
	private int messageCounter = 0 ;
	
	private boolean restarting = false;
	
	private LifeCycle myLifeCycle;
	private LifeCycle myBufferedLifeCycle;
	private LifeCycle myActiveLifeCycle;
	private transient LifeCycle myDeletedLifeCycle;
	//#MIDP_EXCLUDE_BEGIN
	private transient LifeCycle mySuspendedLifeCycle;
	//#MIDP_EXCLUDE_END
	
	/**
	 This flag is used to distinguish the normal AP_ACTIVE state from
	 the particular case in which the agent state is set to AP_ACTIVE
	 during agent termination to allow it to deregister with the AMS. 
	 In this case in fact a call to <code>doDelete()</code>, 
	 <code>doMove()</code>, <code>doClone()</code> and <code>doSuspend()</code>
	 should have no effect.
	 */
	private boolean terminating = false;
	
	//#MIDP_EXCLUDE_BEGIN
	// For persistence service
	private void setTerminating(boolean b) {
		terminating = b;
	}
	
	// For persistence service
	private boolean getTerminating() {
		return terminating;
	}
	
	/** 
	 When set to false (default) all behaviour-related events (such as ADDED_BEHAVIOUR
	 or CHANGED_BEHAVIOUR_STATE) are not generated in order to improve performances.
	 These events in facts are very frequent.
	 */
	private boolean generateBehaviourEvents = false;
	//#MIDP_EXCLUDE_END
	
	/*#MIDP_INCLUDE_BEGIN
	 public static MIDlet midlet;
	 
	 // Flag for agent interruption (necessary as Thread.interrupt()
	  // is not available in MIDP)
	   private boolean isInterrupted = false;
	   #MIDP_INCLUDE_END*/
	
	/**
	 Default constructor.
	 */
	public Agent() {
		//#MIDP_EXCLUDE_BEGIN
		myToolkit = DummyToolkit.instance();
		o2aLocks = new HashMap();
		msgQueue = new MessageQueue(msgQueueMaxSize);
		suspendLock = new Object();
		//#MIDP_EXCLUDE_END
		/*#MIDP_INCLUDE_BEGIN
		 msgQueue = new MessageQueue();
		 #MIDP_INCLUDE_END*/
		stateLock = new Object(); 
		pendingTimers = new AssociationTB();
		myActiveLifeCycle = new ActiveLifeCycle();
		myLifeCycle = myActiveLifeCycle;
		myScheduler = new Scheduler(this);
		theDispatcher = TimerDispatcher.getTimerDispatcher();
	}
	
	//#MIDP_EXCLUDE_BEGIN
	/**
	 Constructor to be used by special "agents" that will never powerUp.
	 */
	Agent(AID id) {
		setAID(id);
	}
	
	// For persistence service
	private Long persistentID;
	
	// For persistence service
	private Long getPersistentID() {
		return persistentID;
	}
	
	// For persistence service
	private void setPersistentID(Long l) {
		persistentID = l;
	}
	
	
	/** 
	 * Declared transient because the container changes in case
	 * of agent migration.
	 */
	private transient jade.wrapper.AgentContainer myContainer = null;
	
	/**
	 * Return a controller for the container this agent lives in. 
	 * <br>
	 * <b>NOT available in MIDP</b>
	 * <br>
	 * @return jade.wrapper.AgentContainer a controller for the container this agent lives in.
	 */
	public final jade.wrapper.AgentContainer getContainerController() {
		if (myContainer == null) {  // first time called
			try {
				jade.security.JADEPrincipal principal = null;
				jade.security.Credentials credentials = null;
				try {
					jade.security.CredentialsHelper ch = (jade.security.CredentialsHelper) getHelper("jade.core.security.Security");
					principal = ch.getPrincipal();
					credentials = ch.getCredentials();
				}
				catch (ServiceException se) {
					// Security plug-in not present. Ignore it
				}
				myContainer = myToolkit.getContainerController(principal, credentials);
			} catch (Exception e) {
				throw new IllegalStateException("A ContainerController cannot be got for this agent. Probably the method has been called at an appropriate time before the complete initialization of the agent.");
			}
		}
		return myContainer;
	}
	//#MIDP_EXCLUDE_END
	
	
	private transient Object[] arguments = null;  // array of arguments
	//#APIDOC_EXCLUDE_BEGIN
	/**
	 * Called by AgentContainerImpl in order to pass arguments to a
	 * just created Agent. 
	 * <p>Usually, programmers do not need to call this method in their code.
	 * @see #getArguments() how to get the arguments passed to an agent
	 **/
	public final void setArguments(Object args[]) {
		// I have declared the method final otherwise getArguments would not work!
		arguments=args;
	}
	//#APIDOC_EXCLUDE_END
	
	/**
	 * Get the array of arguments passed to this agent.
	 * <p> Take care that the arguments are transient and they do not
	 * migrate with the agent neither are cloned with the agent!
	 * @return the array of arguments passed to this agent.
	 * @see <a href=../../../tutorials/ArgsAndPropsPassing.htm>How to use arguments or properties to configure your agent.</a>
	 **/
	public Object[] getArguments() {
		return arguments;
	}
	
	void setRestarting(boolean restarting) {
		this.restarting = restarting;
	}
	
	/**
	 * This method returns <code>true</code> when this agent is restarting after a crash.
	 * The restarting indication is automatically reset as soon as the <code>setup()</code> method of 
	 * this agent terminates.
	 * @return <code>true</code> when this agent is restarting after a crash. <code>false</code> otherwise.
	 */
	public final boolean isRestarting() {
		return restarting;
	}
	/**
	 Get the Agent ID for the platform AMS.
	 @return An <code>AID</code> object, that can be used to contact
	 the AMS of this platform.
	 */
	public final AID getAMS() {
		return myToolkit.getAMS();  
	}
	
	/**
	 Get the Agent ID for the platform default DF.
	 @return An <code>AID</code> object, that can be used to contact
	 the default DF of this platform.
	 */
	public final AID getDefaultDF() {
		return myToolkit.getDefaultDF();
	}
	
	
	/**
	 Method to query the agent local name.
	 @return A <code>String</code> containing the local agent name
	 (e.g. <em>peter</em>).
	 */
	public final String getLocalName() {
		return myName;
	}
	
	/**
	 Method to query the agent complete name (<em><b>GUID</b></em>).
	 @return A <code>String</code> containing the complete agent name
	 (e.g. <em>peter@fipa.org:50</em>).
	 */
	public final String getName() { 
		if (myHap != null) {
			return myName + '@' + myHap;
		}
		else {
			return myName;
		}
	}
	
	/**
	 * Method to query the Home Agent Platform. This is the name of
	 * the platform where the agent has been created, therefore it will 
	 * never change during the entire lifetime of the agent.
	 * In JADE the name of an agent by default is composed by the 
	 * concatenation (using '@') of the agent local name and the Home 
	 * Agent Platform name 
	 *
	 * @return A <code>String</code> containing the name of the home agent platform
	 * (e.g. <em>myComputerName:1099/JADE</em>).
	 */
	public final String getHap() {
		return myHap;
	}
	
	/**
	 Method to query the private Agent ID. Note that this Agent ID is
	 <b>different</b> from the one that is registered with the
	 platform AMS.
	 @return An <code>Agent ID</code> object, containing the complete
	 agent GUID, addresses and resolvers.
	 */
	public final AID getAID() {
		return myAID;
	}
	
	void setAID(AID id) {
		myName = id.getLocalName();
		myHap = id.getHap();
		myAID = id;
	}
	
	/**
	 This method adds a new platform address to the AID of this Agent.
	 It is called by the container when a new MTP is activated
	 in the platform (in the local container - installMTP() -  
	 or in a remote container - updateRoutingTable()) to keep the 
	 Agent AID updated.
	 */
	synchronized void addPlatformAddress(String address) { // Mutual exclusion with Agent.powerUp()
		if (myAID != null) {
			// Cloning the AID is necessary as the agent may be using its AID.
			// If this is the case a ConcurrentModificationException would be thrown
			myAID = (AID)myAID.clone(); 
			myAID.addAddresses(address);
		}
	}
	
	/**
	 This method removes an old platform address from the AID of this Agent.
	 It is called by the container when a new MTP is deactivated
	 in the platform (in the local container - uninstallMTP() -  
	 or in a remote container - updateRoutingTable()) to keep the 
	 Agent AID updated.
	 */
	synchronized void removePlatformAddress(String address) { // Mutual exclusion with Agent.powerUp()
		if (myAID != null) {
			// Cloning the AID is necessary as the agent may be using its AID.
			// If this is the case a ConcurrentModificationException would be thrown
			myAID = (AID)myAID.clone(); 
			myAID.removeAddresses(address);
		}
	}
	
	/**
	 Method to retrieve the location this agent is currently at.
	 @return A <code>Location</code> object, describing the location
	 where this agent is currently running.
	 */
	public Location here() {
		return myToolkit.here();
	}
	
	//#APIDOC_EXCLUDE_BEGIN
	/**
	 * This method is used internally by the framework and should NOT be used by programmers.
	 * This is used by the agent container to wait for agent termination.
	 * We have already called doDelete on the thread which would have
	 * issued an interrupt on it. However, it still may decide not to exit.
	 * So we will wait no longer than 5 seconds for it to exit and we
	 * do not care of this zombie agent.
	 * FIXME: we must further isolate container and agents, for instance
	 * by using custom class loader and dynamic proxies and JDK 1.3.
	 * FIXME: the timeout value should be got by Profile
	 */
	public void join() {
		//#MIDP_EXCLUDE_BEGIN
		try {
			if(myThread == null) {
				return;
			}
			myThread.join(5000);
			if (myThread.isAlive()) {
				System.out.println("*** Warning: Agent " + myName + " did not terminate when requested to do so.");
				if(!myThread.equals(Thread.currentThread())) {
					myThread.interrupt();
					System.out.println("*** Second interrupt issued.");
				}
			}
		}
		catch(InterruptedException ie) {
			ie.printStackTrace();
		}
		//#MIDP_EXCLUDE_END
		/*#MIDP_INCLUDE_BEGIN
		 if (myThread != null && myThread.isAlive()) {
		 try {
		 myThread.join();
		 } 
		 catch (InterruptedException ie) {
		 ie.printStackTrace();
		 } 
		 } 
		 #MIDP_INCLUDE_END*/
	}
	//#APIDOC_EXCLUDE_END
	
	/**
	 Set message queue size. This method allows to change the number
	 of ACL messages that can be buffered before being actually read
	 by the agent or discarded.
	 @param newSize A non negative integer value to set message queue
	 size to. Passing 0 means unlimited message queue.  When the number of 
	 buffered
	 messages exceeds this value, older messages are discarded
	 according to a <b><em>FIFO</em></b> replacement policy.
	 @throws IllegalArgumentException If <code>newSize</code> is negative.
	 @see jade.core.Agent#getQueueSize()
	 */
	public void setQueueSize(int newSize) throws IllegalArgumentException {
		msgQueue.setMaxSize(newSize);
		//#MIDP_EXCLUDE_BEGIN
		msgQueueMaxSize = newSize;
		//#MIDP_EXCLUDE_END
	}
	
	/**
	 * This method retrieves the current lenght of the message queue
	 * of this agent.
	 * @return The number of messages that are currently stored into the
	 * message queue.
	 **/
	public int getCurQueueSize() {
		return msgQueue.size();
	}
	
	/**
	 Reads message queue size. A zero value means that the message
	 queue is unbounded (its size is limited only by amount of
	 available memory).
	 @return The actual size of the message queue (i.e. the max number
	 of messages that can be stored into the queue)
	 @see jade.core.Agent#setQueueSize(int newSize)
	 @see jade.core.Agent#getCurQueueSize()
	 */
	public int getQueueSize() {
		return msgQueue.getMaxSize();
	}
	
	
	/////////////////////////////////
	// Agent state management
	/////////////////////////////////
	public void changeStateTo(LifeCycle newLifeCycle) {
		boolean changed = false;
		newLifeCycle.setAgent(this);
		synchronized (stateLock) {
			if (!myLifeCycle.equals(newLifeCycle)) {
				// The new state is actually different from the current one
				if (myLifeCycle.transitionTo(newLifeCycle)) {
					myBufferedLifeCycle = myLifeCycle;
					myLifeCycle = newLifeCycle;
					changed = true;
					//#MIDP_EXCLUDE_BEGIN
					notifyChangedAgentState(myBufferedLifeCycle.getState(), myLifeCycle.getState());
					//#MIDP_EXCLUDE_END
				}
			}
		}
		if (changed) {
			myLifeCycle.transitionFrom(myBufferedLifeCycle);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人精品亚洲日本在线桃色| 欧美美女bb生活片| 激情都市一区二区| 国产成人在线视频网站| 不卡一区二区中文字幕| 91国偷自产一区二区三区成为亚洲经典 | 久久精品免费看| 色婷婷激情一区二区三区| 欧美一区二区日韩一区二区| 久久久精品tv| 视频在线观看国产精品| 国产91精品露脸国语对白| 在线看一区二区| 久久久青草青青国产亚洲免观| 亚洲人午夜精品天堂一二香蕉| 亚洲一区二区欧美日韩| 国产九色精品成人porny | 亚洲国产高清不卡| 水野朝阳av一区二区三区| 9久草视频在线视频精品| 欧美高清精品3d| 一区二区三区国产精品| av在线这里只有精品| 精品日产卡一卡二卡麻豆| 亚洲午夜成aⅴ人片| 欧美曰成人黄网| 亚洲乱码国产乱码精品精小说| gogo大胆日本视频一区| 日韩欧美一级二级三级久久久| 成人欧美一区二区三区黑人麻豆| 久久电影国产免费久久电影 | 国产精品色眯眯| 国产河南妇女毛片精品久久久| 亚洲精品在线观| 国产在线视视频有精品| 2021国产精品久久精品| 国产精品影音先锋| 久久久国产精品午夜一区ai换脸 | 欧美日韩一卡二卡三卡| 亚洲电影中文字幕在线观看| 久久九九久久九九| 岛国精品在线播放| 中文字幕一区二区三区蜜月| 成人sese在线| 亚洲国产色一区| 欧美一级片免费看| 国产成人精品综合在线观看| 中文字幕一区二区三区在线观看| 99精品视频一区二区三区| 亚洲高清中文字幕| 久久只精品国产| 欧美日精品一区视频| 亚洲成人午夜影院| 久久久久久久久蜜桃| 欧美三级中文字幕在线观看| 免费成人在线观看| 亚洲欧洲在线观看av| 欧美日韩免费在线视频| 国产精品66部| 视频一区二区国产| 中文字幕一区二区在线观看 | 亚洲午夜精品网| 中文字幕五月欧美| 久久综合精品国产一区二区三区| 99综合影院在线| 国产大片一区二区| 国产真实乱子伦精品视频| 亚洲激情图片qvod| 国产精品福利一区| 国产午夜精品一区二区三区视频| 欧美久久一二区| 欧美日韩一区小说| 日本高清不卡在线观看| 91日韩精品一区| 99麻豆久久久国产精品免费| 国产制服丝袜一区| 国产在线日韩欧美| 国产精品自拍一区| 成人精品鲁一区一区二区| 久久精品国产亚洲a| 卡一卡二国产精品 | 亚洲欧洲成人精品av97| 欧美激情一区二区三区蜜桃视频| 91精品国产入口在线| 91精品国产aⅴ一区二区| 欧美中文字幕一区| 91精品欧美综合在线观看最新| 欧美丰满高潮xxxx喷水动漫| 欧美一级搡bbbb搡bbbb| 国产欧美一区二区精品性色| 亚洲免费毛片网站| 麻豆精品久久久| 成人av高清在线| 欧美巨大另类极品videosbest | 欧美日韩情趣电影| 久久久精品国产免大香伊 | 韩国视频一区二区| 日本韩国一区二区| 欧美成人国产一区二区| 国产精品女上位| 91一区一区三区| 日韩一区二区在线观看| 亚洲国产高清不卡| 男女性色大片免费观看一区二区| 国产不卡高清在线观看视频| 色综合 综合色| 久久亚洲春色中文字幕久久久| 玉足女爽爽91| 不卡av在线免费观看| 欧美mv日韩mv| 免费人成精品欧美精品| 色婷婷综合久色| 国产精品久久二区二区| 国产一区二区三区黄视频| 6080yy午夜一二三区久久| 一区二区三区国产精华| av电影在线观看一区| 久久久久免费观看| 国产永久精品大片wwwapp| 欧美成人精品高清在线播放| 蜜桃视频免费观看一区| 欧美色图一区二区三区| 一区二区三区四区五区视频在线观看| 成人高清在线视频| 国产精品国产自产拍在线| 91免费版在线看| 亚洲国产日韩av| 91精品欧美久久久久久动漫 | 日韩精品国产精品| 中文字幕一区二区三区在线播放 | 成人三级伦理片| 一区二区三区在线播| 欧美一区三区二区| 成人一区在线观看| 亚洲精品五月天| 欧美精品v国产精品v日韩精品| 日本三级韩国三级欧美三级| 欧美韩国日本综合| 成人毛片视频在线观看| 香蕉影视欧美成人| 久久精品一区二区三区不卡| 91小视频在线观看| 久久精品国产第一区二区三区| 国产精品少妇自拍| 欧美一卡在线观看| 99久久久久久| 麻豆91免费看| 国产精品视频免费| 欧美一区二区三区不卡| 91在线免费播放| 国产精品中文有码| 蜜臀av一区二区在线免费观看| 久久精品欧美日韩精品| 91精选在线观看| 在线观看日产精品| av中文字幕一区| 99这里只有精品| 国产经典欧美精品| 极品尤物av久久免费看| 亚洲综合精品自拍| 伊人开心综合网| 亚洲日本在线a| 日韩一区在线看| 国产精品色噜噜| 国产精品欧美一级免费| 国产清纯在线一区二区www| 亚洲精品一区二区三区99| 在线观看91av| 欧美一级在线视频| 欧美一区二区高清| 欧美精品一区二区三区在线播放| 日韩欧美一二三四区| 日韩一二三区不卡| 国产无一区二区| 亚洲精品一二三| 蜜桃91丨九色丨蝌蚪91桃色| 精品一区二区三区免费| 国产一区999| 国产成a人亚洲精品| 97精品国产97久久久久久久久久久久 | 99久久夜色精品国产网站| 色综合久久久久综合体| 欧美美女激情18p| 国产亚洲欧美色| 亚洲综合色成人| 国产在线一区观看| 一本色道久久综合亚洲精品按摩| 777午夜精品视频在线播放| 欧美成人一区二区三区| 一区二区在线观看不卡| 蜜臀av亚洲一区中文字幕| 国产.欧美.日韩| 欧美日韩性生活| 国产日韩欧美制服另类| 日本伊人色综合网| 99久久婷婷国产综合精品| 欧美一区国产二区| 亚洲第一在线综合网站| 色综合久久久久网| 国产日本一区二区|