com.lyrisoft.chat.client.command
Class UserCommandProcessor

java.lang.Object
  |
  +--com.lyrisoft.chat.client.command.UserCommandProcessor
Direct Known Subclasses:
Emote, EmoteUser, Help, Hyperlink, Ignore, Join, Kick, Kill, Op, Part, Ping, Rooms, SayToRoom, SayToUser, SignOff, Stats, UnIgnore, Users, Whois

public abstract class UserCommandProcessor
extends java.lang.Object

Process a command that came from the user or user interface


Constructor Summary
UserCommandProcessor()
           
 
Method Summary
 java.lang.String[] decompose(java.lang.String input, int nArgs)
          Subclasses might find this method useful.
 java.lang.String[] decompose(java.lang.String input, java.lang.String arg, int nArgs)
          Subclasses might find this method useful.
abstract  void process(java.lang.String input, java.lang.String arg, Client client)
          Process some user input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserCommandProcessor

public UserCommandProcessor()
Method Detail

process

public abstract void process(java.lang.String input,
                             java.lang.String arg,
                             Client client)
                      throws NotEnoughArgumentsException
Process some user input. The subclass implements this method.
Parameters:
input - the input that the user typed
arg - an optional additional argument that the GUI might have passed. For example, a room name.

decompose

public java.lang.String[] decompose(java.lang.String input,
                                    int nArgs)
                             throws NotEnoughArgumentsException
Subclasses might find this method useful. Decomposes a string into a specified number of args. The String gets split on the space character (' '). If there are more tokens in the string than 'nArgs', the last arg is the remainder of the line.
 Example:
 format("msg joe hi, how are you doing", 3)
 returns: { "msg", "joe", "hi, how are you doing" }
 
Parameters:
input - the raw string
nArgs - the number of args to create in the array
Returns:
a String composed of args, delimited by ICommands.DELIMITER
Throws:
NotEnoughArgumentsException - if there were not enough arguments in the input to create an array of length nArgs

decompose

public java.lang.String[] decompose(java.lang.String input,
                                    java.lang.String arg,
                                    int nArgs)
                             throws NotEnoughArgumentsException
Subclasses might find this method useful. Does exactly the same as the other decompose() method, except 'arg' is inserted as the second argument.
 Example:
 format("msg hi, how are you", "joe", 3)
 returns: { "msg", "joe", "hi, how are you" }
 
Parameters:
input - the raw string
arg - the argument to insert
nArgs - the number of args to create in the array
Returns:
a String composed of args, delimited by ICommands.DELIMITER
Throws:
NotEnoughArgumentsException - if there were not enough arguments in the input to create an array of length nArgs


Copyright © 2000-2002 Taso Lyristis