net.jackofalltrades.irc
Class CtcpCommand

java.lang.Object
  extended bynet.jackofalltrades.irc.CtcpCommand

public class CtcpCommand
extends java.lang.Object

Represents a command received in the "trailing" portion of a command received via IRC. CTCP commands are delimited by \001 characters.

Since:
0.5-alpha
Version:
$Revision: 1.6 $ $Date: 2003/08/03 21:01:37 $
Author:
Bradley M. Handy

Field Summary
static java.lang.String ACTION_COMMAND
          the name for an "action" ctcp command.
static java.lang.String CLIENT_INFO_COMMAND
          the name for a "clientinfo" ctcp command.
static java.lang.String DCC_COMMAND
          the name for a "dcc" ctcp command.
static java.lang.String ERROR_MESSAGE_COMMAND
          the name for an error message ctcp command.
static java.lang.String FINGER_COMMAND
          the name for a "finger" ctcp command.
static java.lang.String SED_COMMAND
          the name for a "sed" (send encrypted data) ctcp command.
static java.lang.String SOURCE_COMMAND
          the name for a "source" ctcp command.
static java.lang.String TIME_COMMAND
          the name for a "time" ctcp command.
static java.lang.String USER_INFO_COMMAND
          the name for a "userinfo" ctcp command.
static java.lang.String VERSION_COMMAND
          the name for a "version" ctcp command.
 
Constructor Summary
CtcpCommand()
          Creates a new instance of CtcpCommand.
CtcpCommand(java.lang.String name)
          Creates a new named instance of CtcpCommand.
CtcpCommand(java.lang.String name, java.util.List params)
          Creates a new named instance of CtcpCommand with the specified parameters.
CtcpCommand(java.lang.String name, java.lang.String[] params)
          Creates a new named instance of CtcpCommand with the specified parameters.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines if o is equal to the current CtcpCommand.
 java.lang.String getName()
          Returns the name of the command.
 java.lang.String getParam(int index)
          Returns the String parameter at the specified index.
 java.util.List getParams()
          Returns a copy of the java.util.List of String parameters.
 int hashCode()
          Returns a hashcode for the current CtcpCommand.
 boolean hasParams()
          Indicates whether the current CtcpCommand has parameters.
 void setName(java.lang.String name)
          Sets the name of the command.
 void setParams(java.util.List params)
          Sets the java.util.List of String parameters.
 java.lang.String toString()
          Returns a String representation of the command's name and parameters.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FINGER_COMMAND

public static final java.lang.String FINGER_COMMAND
the name for a "finger" ctcp command.

See Also:
Constant Field Values

VERSION_COMMAND

public static final java.lang.String VERSION_COMMAND
the name for a "version" ctcp command.

See Also:
Constant Field Values

SOURCE_COMMAND

public static final java.lang.String SOURCE_COMMAND
the name for a "source" ctcp command.

See Also:
Constant Field Values

USER_INFO_COMMAND

public static final java.lang.String USER_INFO_COMMAND
the name for a "userinfo" ctcp command.

See Also:
Constant Field Values

CLIENT_INFO_COMMAND

public static final java.lang.String CLIENT_INFO_COMMAND
the name for a "clientinfo" ctcp command.

See Also:
Constant Field Values

ERROR_MESSAGE_COMMAND

public static final java.lang.String ERROR_MESSAGE_COMMAND
the name for an error message ctcp command.

See Also:
Constant Field Values

TIME_COMMAND

public static final java.lang.String TIME_COMMAND
the name for a "time" ctcp command.

See Also:
Constant Field Values

ACTION_COMMAND

public static final java.lang.String ACTION_COMMAND
the name for an "action" ctcp command.

See Also:
Constant Field Values

DCC_COMMAND

public static final java.lang.String DCC_COMMAND
the name for a "dcc" ctcp command.

See Also:
Constant Field Values

SED_COMMAND

public static final java.lang.String SED_COMMAND
the name for a "sed" (send encrypted data) ctcp command.

See Also:
Constant Field Values
Constructor Detail

CtcpCommand

public CtcpCommand()
Creates a new instance of CtcpCommand.


CtcpCommand

public CtcpCommand(java.lang.String name)
Creates a new named instance of CtcpCommand.

Parameters:
name - the name of the CtcpCommand.

CtcpCommand

public CtcpCommand(java.lang.String name,
                   java.lang.String[] params)
Creates a new named instance of CtcpCommand with the specified parameters.

Parameters:
name - the name of the CtcpCommand.
params - the parameters for the command.
Throws:
java.lang.IllegalArgumentException - if name is blank or null.

CtcpCommand

public CtcpCommand(java.lang.String name,
                   java.util.List params)
Creates a new named instance of CtcpCommand with the specified parameters.

Parameters:
name - the name of the CtcpCommand.
params - the parameters for the command.
Throws:
java.lang.IllegalArgumentException - if name is blank or null.
Method Detail

getName

public java.lang.String getName()
Returns the name of the command.


setName

public void setName(java.lang.String name)
Sets the name of the command.

Parameters:
name - the new command name.
Throws:
java.lang.IllegalArgumentException - if name is blank or null.

getParams

public java.util.List getParams()
Returns a copy of the java.util.List of String parameters.

Returns:
a copy of the actual parameters.

setParams

public void setParams(java.util.List params)
Sets the java.util.List of String parameters.

Parameters:
params - the new parameter java.util.List.

hasParams

public boolean hasParams()
Indicates whether the current CtcpCommand has parameters.

Returns:
true if the command has parameters, false otherwise.

getParam

public java.lang.String getParam(int index)
Returns the String parameter at the specified index.

Parameters:
index - the zero-based index of the parameter to be returned.
Returns:
the value of the parameters at index or null.

equals

public boolean equals(java.lang.Object o)
Determines if o is equal to the current CtcpCommand.

Parameters:
o - the object to compare.
Returns:
true if o is equivalent to the current object, otherwise false.

hashCode

public int hashCode()
Returns a hashcode for the current CtcpCommand.

Returns:
an integer hashcode.

toString

public java.lang.String toString()
Returns a String representation of the command's name and parameters.

Returns:
the command name followed by it's parameter delimited by spaces.


Copyright © 2002-2003 Jack-of-all-trades Programming Services. All Rights Reserved.