wxtutils
Class command

java.lang.Object
  extended bywxtutils.command

public class command
extends java.lang.Object

Parses and stores the content of a Processing Instruction node according to a name-value, attribute-like, philosophy


Field Summary
protected  java.lang.String m_Cmd
          The main command, what to do
protected  java.lang.String m_originalData
          the string as we received it in the constructor
 
Constructor Summary
command(java.lang.String data, unit theUnit)
          Creates a new instance of command
 
Method Summary
protected  boolean expandParams(java.util.HashMap propMap)
          Expand any parameter with named properties from propMap Expect: "//image[position()='_wxt_property(index)']/description"
 java.lang.String getCommand()
          Returns the command, m_Cmd
 java.lang.String getValue(java.lang.String n)
          Returns a value, returns null if no match
 int getValueAsInteger(java.lang.String n)
          Returns an integer value, returns -1 if no match
protected  boolean nonEmptyValues()
          Check all params for empty value
 boolean paramExist(java.lang.String n)
          Returns true if the string n exists as name, false otherwise
protected  boolean parse(java.lang.String data)
          Parse the content of a PI.
 java.lang.String toString()
          Returns the command as a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Cmd

protected java.lang.String m_Cmd
The main command, what to do


m_originalData

protected java.lang.String m_originalData
the string as we received it in the constructor

Constructor Detail

command

public command(java.lang.String data,
               unit theUnit)
        throws java.lang.Exception
Creates a new instance of command

Throws:
java.lang.Exception - thrown when parse error
Method Detail

getCommand

public java.lang.String getCommand()
Returns the command, m_Cmd

Returns:
The commands name

toString

public java.lang.String toString()
Returns the command as a string

Returns:
The commandas unparsed string, original

getValue

public java.lang.String getValue(java.lang.String n)
Returns a value, returns null if no match

Parameters:
n - The name to look for
Returns:
The value associated with the name, null if not found

getValueAsInteger

public int getValueAsInteger(java.lang.String n)
Returns an integer value, returns -1 if no match

Parameters:
n - The anme we are looking for
Returns:
The matching value as an integer, -1 if not found

paramExist

public boolean paramExist(java.lang.String n)
Returns true if the string n exists as name, false otherwise

Parameters:
n - The name to look for
Returns:
true if the string n exists as name, false otherwise

parse

protected boolean parse(java.lang.String data)
Parse the content of a PI. Expected input: command name1="value1" name2="value2"

Parameters:
data - The string to parse.
Returns:
true if successful, false otherwise

expandParams

protected boolean expandParams(java.util.HashMap propMap)
Expand any parameter with named properties from propMap Expect: "//image[position()='_wxt_property(index)']/description"

Parameters:
propMap - Properties which are candidates for expansion

nonEmptyValues

protected boolean nonEmptyValues()
Check all params for empty value