org.xnap.plugin.gift.net.lexer
Class Command

java.lang.Object
  extended by org.xnap.plugin.gift.net.lexer.Command

public class Command
extends java.lang.Object

Command Represents a GiFT-Command

Version:
CVS $Id: Command.java,v 1.2 2003/10/06 10:17:37 squig Exp $
Author:
Tammo van Lessen

Constructor Summary
Command()
          Creates an empty Command object.
Command(java.lang.String cmd)
          Creates a new cmd-Command object.
 
Method Summary
 void addKey(java.lang.String key)
          Adds a key without its argument
 void addKey(java.lang.String key, java.lang.String arg)
          Adds a key with its argument
 void addSubCommand(Command command)
          Adds a subcommand
 java.util.Vector getAllSubCommandsByName(java.lang.String key)
          Method getAllSubCommandsByName.
 java.lang.String getCommand()
          returns the command
 java.lang.String getCommandArgument()
          Returns the commands argument
 java.lang.String getCommandModifier()
          Returns the commands modifier
 java.lang.String getKey(java.lang.String key)
          Returns the argument corresponding to the given key
 java.lang.String getKeyModifier(java.lang.String key)
          Returns the modifier for the given key.
 java.util.Enumeration getKeys()
          Returns all keys
 Command getSubCommandByName(java.lang.String key)
          Returns the subcommand by its name If more subcommands with the same name exists, the first will be returned
 java.util.Vector getSubCommands()
          Returns all subcommands (its names)
 boolean hasKeys()
          Returns if command has keys
 boolean parse(java.lang.String cmd)
          Parses the command from a String (GiFT-UI-protocol)
 java.lang.String print()
          Returns the command as String (GiFT-UI-protocol)
 void setCommandArgument(java.lang.String arg)
          Sets the commands argument
 void setCommandModifier(java.lang.String arg)
          Sets the modifier for the command
 void setKeyArgument(java.lang.String key, java.lang.String arg)
          Sets the argument for the given key
 void setKeyModifier(java.lang.String key, java.lang.String mod)
          Sets the modifier for the specified key.
 java.lang.String toString()
          Debugdump
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Command

public Command(java.lang.String cmd)
Creates a new cmd-Command object.

Parameters:
cmd - the command's name

Command

public Command()
Creates an empty Command object.

Method Detail

getAllSubCommandsByName

public java.util.Vector getAllSubCommandsByName(java.lang.String key)
Method getAllSubCommandsByName.


getCommand

public java.lang.String getCommand()
returns the command

Returns:
the command's name

setCommandArgument

public void setCommandArgument(java.lang.String arg)
Sets the commands argument

Parameters:
arg - the argument

getCommandArgument

public java.lang.String getCommandArgument()
Returns the commands argument

Returns:
the argument

setCommandModifier

public void setCommandModifier(java.lang.String arg)
Sets the modifier for the command

Parameters:
arg - the modifier

getCommandModifier

public java.lang.String getCommandModifier()
Returns the commands modifier

Returns:
the modifier

getKey

public java.lang.String getKey(java.lang.String key)
Returns the argument corresponding to the given key

Parameters:
key - the key
Returns:
the key's argument

setKeyArgument

public void setKeyArgument(java.lang.String key,
                           java.lang.String arg)
Sets the argument for the given key

Parameters:
key - the key
arg - the argument

setKeyModifier

public void setKeyModifier(java.lang.String key,
                           java.lang.String mod)
Sets the modifier for the specified key.

Parameters:
key - the key
mod - the modifier

getKeyModifier

public java.lang.String getKeyModifier(java.lang.String key)
Returns the modifier for the given key.

Parameters:
key - the key
Returns:
the modifier

getKeys

public java.util.Enumeration getKeys()
Returns all keys

Returns:
all keys

getSubCommandByName

public Command getSubCommandByName(java.lang.String key)
Returns the subcommand by its name If more subcommands with the same name exists, the first will be returned

Parameters:
key - the subcommands name
Returns:
the subcommand

getSubCommands

public java.util.Vector getSubCommands()
Returns all subcommands (its names)

Returns:
the subcommands

addKey

public void addKey(java.lang.String key,
                   java.lang.String arg)
Adds a key with its argument

Parameters:
key - the key
arg - the argument

addKey

public void addKey(java.lang.String key)
Adds a key without its argument

Parameters:
key - the key

addSubCommand

public void addSubCommand(Command command)
Adds a subcommand

Parameters:
command - the subcommand

hasKeys

public boolean hasKeys()
Returns if command has keys

Returns:
hasKeys

parse

public boolean parse(java.lang.String cmd)
Parses the command from a String (GiFT-UI-protocol)

Parameters:
cmd - the String

print

public java.lang.String print()
Returns the command as String (GiFT-UI-protocol)

Returns:
the commandstr

toString

public java.lang.String toString()
Debugdump

Overrides:
toString in class java.lang.Object
Returns:
String


Copyright © 2001-2005 XNap Team. All Rights Reserved.