| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectf00f.net.irc.martyr.commands.AbstractInCommand
public abstract class AbstractInCommand
Defines a generic command. Most commands will simply have to override the getIrcIdentifier method and implement the parse and render methods using convenience methods.
| Field Summary | |
|---|---|
protected  java.util.Map<java.lang.String,java.lang.String> | 
attributes
 | 
| Constructor Summary | |
|---|---|
protected  | 
AbstractInCommand()
 | 
protected  | 
AbstractInCommand(java.lang.String[] attributeNames)
 | 
| Method Summary | |
|---|---|
 java.lang.String | 
getAttribute(java.lang.String key)
Returns the attribute, or null if the attribute does not exist, or is not defined.  | 
 java.util.Iterator | 
getAttributeKeys()
Returns an iterator of String objects over the attribute names for this command.  | 
 int | 
getIntParameter(java.lang.String params,
                int paramnum,
                int defaultNum)
 | 
 java.lang.String | 
getParameter(java.lang.String params,
             int num)
Utility method to make parsing easy.  | 
 java.lang.String | 
getSourceString()
Allows a third party to receive a copy of the raw string.  | 
 State | 
getState()
Some commands, when received by the server, can only occur in one state.  | 
abstract  InCommand | 
parse(java.lang.String prefix,
      java.lang.String identifier,
      java.lang.String params)
Parses a string and produces a formed command object, if it can.  | 
 void | 
selfRegister(CommandRegister commandRegister)
Every command should know how to register itself (or not) with the command parsing engine.  | 
protected  void | 
setAttribute(java.lang.String key,
             java.lang.String value)
 | 
 void | 
setSourceString(java.lang.String source)
Gives the command a copy of the raw string from the server.  | 
 boolean | 
updateClientState(ClientState state)
By default, commands do not update the client state.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Methods inherited from interface f00f.net.irc.martyr.Command | 
|---|
getIrcIdentifier | 
| Field Detail | 
|---|
protected java.util.Map<java.lang.String,java.lang.String> attributes
| Constructor Detail | 
|---|
protected AbstractInCommand()
protected AbstractInCommand(java.lang.String[] attributeNames)
| Method Detail | 
|---|
public java.lang.String getAttribute(java.lang.String key)
InCommand
getAttribute in interface InCommandkey - Attribute to get value of
public java.util.Iterator getAttributeKeys()
InCommand
getAttributeKeys in interface InCommand
protected void setAttribute(java.lang.String key,
                            java.lang.String value)
public State getState()
getState in interface InCommandpublic void selfRegister(CommandRegister commandRegister)
selfRegister in interface InCommandcommandRegister - Command register we want to register with
public abstract InCommand parse(java.lang.String prefix,
                                java.lang.String identifier,
                                java.lang.String params)
parse in interface InCommandprefix - Prefix of the commandidentifier - ID of the commandparams - Parameters of the command
public boolean updateClientState(ClientState state)
updateClientState in interface InCommandstate - Client state to be updated
public java.lang.String getParameter(java.lang.String params,
                                     int num)
params - String with parameters in itnum - Position number of parameter to be requested
public int getIntParameter(java.lang.String params,
                           int paramnum,
                           int defaultNum)
public void setSourceString(java.lang.String source)
InCommand
setSourceString in interface InCommandsource - Sets the source string to be parsedpublic java.lang.String getSourceString()
InCommand
getSourceString in interface InCommand
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||