⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lurkertryagent.java

📁 一个agent 工具包,可以开发移动设备应用,考虑了安全措施
💻 JAVA
字号:
import SOMA.agent.*;
import SOMA.naming.*;

/**
 * Coupled with BaseTryAgent, this agent realizes a first try to create and
 * move new agents from an initial place.
 *
 * @author	Giulio Piancastelli
 * @version	0.1 - Wednesday 13th February, 2002
 */
public class LurkerTryAgent extends Agent {
	
	// Serializable fields
	private PlaceID myHome; // the place where the lurker was created
	private PlaceID myNextPlace; // the place where the lurker was said to go
	
	public void putArgument(Object obj) {
		
		// the object is a Vector
		java.util.Vector v = (java.util.Vector) obj;
		myHome = (PlaceID) v.get(0);
		myNextPlace = (PlaceID) v.get(1);
		
	}
	
	public void run() {
		
		try {
			go(myNextPlace, "greetings");
		} catch (CantGoException cge) {
			cge.printStackTrace();
		}
		
	}
	
	public void greetings() {
		
		agentSystem.getOut().println("I come from " + myHome + "- I was said to go to " + myNextPlace + " and I am now in " + agentSystem.getPlaceID());
	
	}
	
} // end LurkerTryAgent

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -