/* Author: Jeff Dalton * Updated: Sun Jul 15 23:10:07 2001 by Jeff Dalton * Copyright: (c) 2001, AIAI, University of Edinburgh */ package ix.test; import ix.icore.IXAgent; import ix.util.*; /** * An example of a very simple I-X agent. Its IPC name can be given * by the "-ipc-name" command-line argument. For example, to pretend * to be I-DEEL: *
 *    java ix.test.SimpleIXAgent -ipc -ipc-name=I-DEEL
 * 
* * @see SimpleIXAgent.java * source code */ public class SimpleIXAgent extends IXAgent { String ipcName = "unknown"; public SimpleIXAgent() { super(); } protected void processCommandLineArguments() { ipcName = Parameters.getParameter("ipc-name", "unknown"); Debug.noteln("Using name", ipcName); // Name needed first, because super sets up IPC. super.processCommandLineArguments(); } protected void startup() { // This is optional. We could just let the first incoming message // cause the text frame to be created. But this way we can make it // appear right away and can add an "Exit" button. textFrame = new TextAreaFrame("Messages for " + ipcName, new String[] { "Exit" } ); textFrame.addListener(new TextAreaFrame.TListener() { public void buttonPressed(String action) { if (action.equals("Exit")) System.exit(0); } }); } public Object getAgentIPCName() { return ipcName; } public static void main(String[] argv) { Util.printGreeting("Simple I-X Agent"); new SimpleIXAgent().mainStartup(argv); } }