package org.vamsas.test.simpleclient; import java.util.Iterator; import java.util.Vector; public class CommandProcessor { /** * this is not getOPT!!!! - processes a *series* of space separated commands - some of which take arguments. */ private Vector commands; /* static { ClientsFileTest.commands=new Vector(); ClientsFileTest.commands.add(new String("add")); ClientsFileTest.commands.add(new String("remove")); ClientsFileTest.commands.add(new String("list")); ClientsFileTest.commands.add(new String("clear")); ClientsFileTest.commands.add(new String("watch")); ClientsFileTest.commands.add(new String("monitor")); } */ public int addCommand(String cmd, int argneed, String complainString) { int cnum=0; if (commands==null) commands = new Vector(); else cnum = commands.size(); Vector cv = new Vector(); cv.add(new String(cmd)); cv.add(new Integer(argneed)); cv.add(new String(complainString)); commands.add(cv); return cnum; } /** * Integer argl, Integer argpos, String cmd, Integer argneed, String msg in vector */ public void complainArgs(int argl, int argpos, Vector ca) { int argneed = ((Integer) ca.get(1)).intValue(); if (argl-argpos2) complainArgs(args.length, argc+1, comnext); return com; } } return -1; } }