eu.xtreemos.xosd.client
Class ParsedCommand

java.lang.Object
  extended by eu.xtreemos.xosd.client.ParsedCommand
All Implemented Interfaces:
java.io.Serializable

public class ParsedCommand
extends java.lang.Object
implements java.io.Serializable

Represents a XtreemOS command parsed, including the Xcommand the flags and the value associated to each flag. Flags start with a - Each flag is followed by a value (one and only one) or none. Values can not contain white spaces

Author:
martag
See Also:
Serialized Form

Field Summary
protected  EnumCommand.ConsoleCommands command
           
protected  java.util.Hashtable<java.lang.String,java.lang.String> flags
           
protected  java.lang.String[] params
           
 
Constructor Summary
ParsedCommand(java.lang.String fullCommand)
          Class constructor specifying the command to be parsed.
ParsedCommand(java.lang.String[] params)
           
 
Method Summary
 EnumCommand.ConsoleCommands getCommand()
          Returns the command of this parsed Command
 int getFlagCount()
          Get the number of parameters.
 java.lang.String getFlagValue(java.lang.String flag)
          Returns a String containing the value associated to the given flag an empty String if there was no value for the flag, or null if this flag was not present in the command.
 java.lang.String[] getParams()
           
 int numParam()
          Returns the number of flags of this parsed command
 void setParams(java.lang.String[] params)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

flags

protected java.util.Hashtable<java.lang.String,java.lang.String> flags

command

protected EnumCommand.ConsoleCommands command

params

protected java.lang.String[] params
Constructor Detail

ParsedCommand

public ParsedCommand(java.lang.String fullCommand)
              throws java.lang.Exception
Class constructor specifying the command to be parsed. The command must be of the type: Xcommand [-flag [value]]

Parameters:
fullCommand - contains the command to be parsed
Throws:
java.lang.Exception

ParsedCommand

public ParsedCommand(java.lang.String[] params)
              throws java.lang.Exception
Parameters:
command -
Throws:
java.lang.Exception
Method Detail

getCommand

public EnumCommand.ConsoleCommands getCommand()
Returns the command of this parsed Command

Returns:
the Comand of this parsed command

getFlagValue

public java.lang.String getFlagValue(java.lang.String flag)
Returns a String containing the value associated to the given flag an empty String if there was no value for the flag, or null if this flag was not present in the command.

Parameters:
flag -
Returns:
A string containing the value the specified flag contains, an empty String if there was no value for the flag, or null if this flag was not present in the command.

numParam

public int numParam()
Returns the number of flags of this parsed command

Returns:
the number of flags of this parsed command

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getParams

public java.lang.String[] getParams()
Returns:
the params

setParams

public void setParams(java.lang.String[] params)
Parameters:
params - the params to set

getFlagCount

public int getFlagCount()
Get the number of parameters.