things.common.commands
Class CommandLine

java.lang.Object
  extended by things.common.commands.CommandLine

public class CommandLine
extends java.lang.Object

A parsed command line.

Version:
1.0

Version History

EPG - Initial - 5 JUN 07
 
Author:
Erich P. Gatejen

Nested Class Summary
static class CommandLine.PARAMETER_TYPES
           
 
Constructor Summary
CommandLine(java.util.HashMap<java.lang.String,NVImmutable> valuesData, java.util.ArrayList<java.lang.String> entitiesData, boolean[] optionsData)
          The only constructor.
 
Method Summary
 java.lang.String getEntity(int index)
          Get an entity as a String.
 NVImmutable getValue(java.lang.String name)
          Get a value as an NVImmutable or null if it isn't present.
 boolean hasEntity(int index)
          Does it have the entity at the index? If the position is not valid, it'll return false (rather than throw arrayoutofbounds).
 boolean hasValue(java.lang.String name)
          Get a value as an NVImmutable or null if it isn't present.
 boolean isOptionSet(int character)
          Check to see if the character is a set option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandLine

public CommandLine(java.util.HashMap<java.lang.String,NVImmutable> valuesData,
                   java.util.ArrayList<java.lang.String> entitiesData,
                   boolean[] optionsData)
            throws ThingsException
The only constructor. Let the CommandLineProcessor make these for you.

Parameters:
valuesData - The values.
entitiesData - The entities.
optionsData - The options map.
Throws:
ThingsException
Method Detail

getEntity

public java.lang.String getEntity(int index)
Get an entity as a String. If the position is not valid, it'll return null (rather than an arrayoutofbounds).

Parameters:
index - in the list (counting from ZERO).
Returns:
The entity.

hasEntity

public boolean hasEntity(int index)
Does it have the entity at the index? If the position is not valid, it'll return false (rather than throw arrayoutofbounds).

Parameters:
index - in the list (counting from ZERO).
Returns:
true if the entity exists.

hasValue

public boolean hasValue(java.lang.String name)
Get a value as an NVImmutable or null if it isn't present.

Parameters:
name - name of the value. It is not case sensitive (normalized to lower-case).
Returns:
true if the value exists.

getValue

public NVImmutable getValue(java.lang.String name)
Get a value as an NVImmutable or null if it isn't present.

Parameters:
name - name of the value. It is not case sensitive (normalized to lower-case).
Returns:
The value as an NVImmutable.
See Also:
NVImmutable

isOptionSet

public boolean isOptionSet(int character)
Check to see if the character is a set option.

Parameters:
character -
Returns:
true if it is, otherwise false.


Things.