WISA.wisa3D.shell
Class CmdParser

java.lang.Object
  |
  +--WISA.wisa3D.shell.CmdParser

public class CmdParser
extends java.lang.Object


Field Summary
static int EQUATION_CMD
           
static int METHOD_CMD
           
static int PLAIN_CMD
           
static int REFERENCE_CMD
           
static int UNKNOWN_CMD
           
 
Constructor Summary
CmdParser()
           
 
Method Summary
protected static int getCmdType(java.lang.String cmd)
          Get the type of the given command.
protected static java.lang.String[] getMethodArgs(java.lang.String cmd)
          Get the arguments of this command if it is a METHOD_CMD.
protected static java.lang.Object[] getVariablesFromNames(java.lang.String[] names)
           
protected static java.lang.String getVarName(java.lang.String cmd)
          Parse the given command and return the variable name.
static java.lang.Object parse(java.lang.String cmd)
           
protected static java.lang.Object parsePlainCmd(java.lang.String cmd)
          Parses a plain cmd.
protected static java.lang.Object parseReferenceCmd(java.lang.String cmd)
          Parses a reference cmd.
protected static java.lang.String trimCmd(java.lang.String s)
          Trims the given String, e.g. removes all spaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_CMD

public static final int UNKNOWN_CMD
See Also:
Constant Field Values

PLAIN_CMD

public static final int PLAIN_CMD
See Also:
Constant Field Values

REFERENCE_CMD

public static final int REFERENCE_CMD
See Also:
Constant Field Values

METHOD_CMD

public static final int METHOD_CMD
See Also:
Constant Field Values

EQUATION_CMD

public static final int EQUATION_CMD
See Also:
Constant Field Values
Constructor Detail

CmdParser

public CmdParser()
Method Detail

getVarName

protected static java.lang.String getVarName(java.lang.String cmd)
Parse the given command and return the variable name.

Parameters:
cmd - The command to be parsed
Returns:
The variable name of this command.

getCmdType

protected static int getCmdType(java.lang.String cmd)
Get the type of the given command. Valid types are UNKNOWN_CMD, PLAIN_CMD, REFERENCE_CMD, METHOD_CMD, EQUATION_CMD.

Parameters:
cmd - The command whose type should be determined.
Returns:
the type of the specified command.

trimCmd

protected static java.lang.String trimCmd(java.lang.String s)
Trims the given String, e.g. removes all spaces.

Parameters:
s - The String to be trimmed.
Returns:
The given String without spaces.

getMethodArgs

protected static java.lang.String[] getMethodArgs(java.lang.String cmd)
                                           throws ConsoleException
Get the arguments of this command if it is a METHOD_CMD.

Parameters:
cmd - The command.
Returns:
The arguments for a method call or null.
ConsoleException

getVariablesFromNames

protected static java.lang.Object[] getVariablesFromNames(java.lang.String[] names)
                                                   throws ConsoleException
ConsoleException

parsePlainCmd

protected static java.lang.Object parsePlainCmd(java.lang.String cmd)
Parses a plain cmd.

Parameters:
cmd - The cmd to be processed.
Returns:
The return value of the processed cmd.

parseReferenceCmd

protected static java.lang.Object parseReferenceCmd(java.lang.String cmd)
                                             throws ConsoleException
Parses a reference cmd.

Parameters:
cmd - The cmd to be processed.
Returns:
The return value of the processed cmd.
ConsoleException

parse

public static java.lang.Object parse(java.lang.String cmd)
                              throws ConsoleException
ConsoleException