net.jackofalltrades.irc
Class IrcCommand

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

public class IrcCommand
extends java.lang.Object

Represents a message received from, or to be sent to, an IRC server.

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

Constructor Summary
IrcCommand()
          Creates a new instance of IrcCommand.
IrcCommand(IrcPrefix prefix, java.lang.String name)
          Creates a new named instance of IrcCommand.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.util.List params)
          Creates a new named instance of IrcCommand with the specified parameters and prefix.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.util.List params, java.lang.String trailing)
          Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.util.List params, java.lang.String trailing, java.util.List ctcpCommands)
          Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.lang.String[] params)
          Creates a new named instance of IrcCommand with the specified parameters.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.lang.String[] params, java.lang.String trailing)
          Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.lang.String[] params, java.lang.String trailing, CtcpCommand[] ctcpCommands)
          Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.lang.String trailing, CtcpCommand[] ctcpCommands)
          Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.
IrcCommand(IrcPrefix prefix, java.lang.String name, java.lang.String trailing, java.util.List ctcpCommands)
          Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.
IrcCommand(java.lang.String name)
          Creates a new named instance of IrcCommand.
IrcCommand(java.lang.String name, java.util.List params)
          Creates a new named instance of IrcCommand with the specified parameters.
IrcCommand(java.lang.String name, java.util.List params, java.lang.String trailing)
          Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.
IrcCommand(java.lang.String name, java.util.List params, java.lang.String trailing, java.util.List ctcpCommands)
          Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.
IrcCommand(java.lang.String name, java.lang.String[] params)
          Creates a new named instance of IrcCommand with the specified parameters.
IrcCommand(java.lang.String name, java.lang.String[] params, java.lang.String trailing)
          Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.
IrcCommand(java.lang.String name, java.lang.String[] params, java.lang.String trailing, CtcpCommand[] ctcpCommands)
          Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.
IrcCommand(java.lang.String name, java.lang.String trailing, CtcpCommand[] ctcpCommands)
          Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.
IrcCommand(java.lang.String name, java.lang.String trailing, java.util.List ctcpCommands)
          Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.
 
Method Summary
 boolean equals(java.lang.Object o)
          Determines if o is equivalent to the current object.
 CtcpCommand getCtcpCommand(int index)
          Indexed getter for property ctcpCommand.
 java.util.List getCtcpCommands()
          Getter for property ctcpCommands.
 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.
 IrcPrefix getPrefix()
          Returns the ident prefix of the message's originator.
 java.lang.String getTrailing()
          Returns the "trailing" portion of the message.
 boolean hasCtcpCommands()
          Indicates whether the current IrcCommand contains any CtcpCommands.
 int hashCode()
          Returns a hashcode of the current object.
 boolean hasParams()
          Indicates whether the current IrcCommand has parameters.
 void setCtcpCommands(java.util.List ctcpCommands)
          Setter for property ctcpCommands.
 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.
 void setPrefix(IrcPrefix prefix)
          Sets the ident prefix of the message's originator.
 void setTrailing(java.lang.String trailing)
          Sets the "trailing" portion of the message.
 java.lang.String toString()
          Returns a string representation of the current object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IrcCommand

public IrcCommand()
Creates a new instance of IrcCommand.


IrcCommand

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

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

IrcCommand

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

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

IrcCommand

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

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

IrcCommand

public IrcCommand(java.lang.String name,
                  java.lang.String[] params,
                  java.lang.String trailing)
Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(java.lang.String name,
                  java.util.List params,
                  java.lang.String trailing)
Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(java.lang.String name,
                  java.lang.String trailing,
                  CtcpCommand[] ctcpCommands)
Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.

Parameters:
name - the name of the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(java.lang.String name,
                  java.lang.String trailing,
                  java.util.List ctcpCommands)
Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.

Parameters:
name - the name of the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(java.lang.String name,
                  java.lang.String[] params,
                  java.lang.String trailing,
                  CtcpCommand[] ctcpCommands)
Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(java.lang.String name,
                  java.util.List params,
                  java.lang.String trailing,
                  java.util.List ctcpCommands)
Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(IrcPrefix prefix,
                  java.lang.String name)
Creates a new named instance of IrcCommand. The prefix specified indicates from whom the command is coming.

Parameters:
prefix - the ident prefix of the message originator.
name - the name of the command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

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

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

IrcCommand

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

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

IrcCommand

public IrcCommand(IrcPrefix prefix,
                  java.lang.String name,
                  java.lang.String[] params,
                  java.lang.String trailing)
Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(IrcPrefix prefix,
                  java.lang.String name,
                  java.util.List params,
                  java.lang.String trailing)
Creates a new named instance of IrcCommand with the specified parameters and a "trailing" message.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(IrcPrefix prefix,
                  java.lang.String name,
                  java.lang.String trailing,
                  CtcpCommand[] ctcpCommands)
Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.

Parameters:
name - the name of the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(IrcPrefix prefix,
                  java.lang.String name,
                  java.lang.String trailing,
                  java.util.List ctcpCommands)
Creates a new named instance of IrcCommand with the "trailing" message and CTCP commands.

Parameters:
name - the name of the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(IrcPrefix prefix,
                  java.lang.String name,
                  java.lang.String[] params,
                  java.lang.String trailing,
                  CtcpCommand[] ctcpCommands)
Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.

IrcCommand

public IrcCommand(IrcPrefix prefix,
                  java.lang.String name,
                  java.util.List params,
                  java.lang.String trailing,
                  java.util.List ctcpCommands)
Creates a new named instance of IrcCommand with the specified parameters, a "trailing" message, and CTCP commands.

Parameters:
name - the name of the command.
params - the parameters for the command.
trailing - the "trailing" portion of the command. (aka. the 15th parameter.)
ctcpCommands - the CTCP command to send with the current command.
Throws:
java.lang.IllegalArgumentException - if name is null or blank.
Method Detail

getPrefix

public IrcPrefix getPrefix()
Returns the ident prefix of the message's originator.

Returns:
the ident prefix.

setPrefix

public void setPrefix(IrcPrefix prefix)
Sets the ident prefix of the message's originator.

Parameters:
prefix - the new ident prefix.

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 null or blank.

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.

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.

hasParams

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

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

getTrailing

public java.lang.String getTrailing()
Returns the "trailing" portion of the message.

Returns:
the message's "trailing" portion.

setTrailing

public void setTrailing(java.lang.String trailing)
Sets the "trailing" portion of the message.

Parameters:
trailing - the message's new "trailing" portion.

getCtcpCommands

public java.util.List getCtcpCommands()
Getter for property ctcpCommands.

Returns:
Value of property ctcpCommands.

setCtcpCommands

public void setCtcpCommands(java.util.List ctcpCommands)
Setter for property ctcpCommands.

Parameters:
ctcpCommands - New value of property ctcpCommands.

hasCtcpCommands

public boolean hasCtcpCommands()
Indicates whether the current IrcCommand contains any CtcpCommands.

Returns:
true if this IrcCommand does have CtcpCommand objects, otherwise false.

getCtcpCommand

public CtcpCommand getCtcpCommand(int index)
Indexed getter for property ctcpCommand.

Parameters:
index - Index of the property.
Returns:
Value of the property at index.

equals

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

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 of the current object.

Returns:
an integer hashcode.

toString

public java.lang.String toString()
Returns a string representation of the current object.

Returns:
the current object's string representation.


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