org.naturalcli
Class ParseResult

java.lang.Object
  extended by org.naturalcli.ParseResult

public class ParseResult
extends java.lang.Object

Encapsulate the data that restuls of a command parse. It means the parameters values and the list of tokens found.

Author:
Ferran Busquets

Constructor Summary
ParseResult(java.lang.Object[] parameterValues, boolean[] tokensGiven)
          Constructor
 
Method Summary
 int getParameterCount()
          Get the number of all possible parameters
 java.lang.Object getParameterValue(int parameterIndex)
          Get the parameter value in the given index.
 java.lang.Object[] getParameterValues()
          Get a copy of the parameter values
 boolean[] getTokensGiven()
          Get a copy of the tokens given.
 boolean isTokenGiven(int tokenIndex)
          Get if the token is given or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParseResult

public ParseResult(java.lang.Object[] parameterValues,
                   boolean[] tokensGiven)
Constructor

Parameters:
paramValues - the ordered parameter values array. For optional parameters not provided will be null
tokensGiven - the ordered array with all the tokens saying if each token is given or not. For non-optional tokens the value will be always true.
Method Detail

getParameterValue

public java.lang.Object getParameterValue(int parameterIndex)
Get the parameter value in the given index.

Parameters:
parameterIndex - the parameter index. This index is relative only for the parameters.
Returns:
the parameter value.

getParameterValues

public java.lang.Object[] getParameterValues()
Get a copy of the parameter values

Returns:
object array with the prameter values

getParameterCount

public int getParameterCount()
Get the number of all possible parameters

Returns:
number of parameters

isTokenGiven

public boolean isTokenGiven(int tokenIndex)
Get if the token is given or not.

Parameters:
tokenIndex - the token index.
Returns:
true if the token is given or false if the token is not given (only for optional parameters).

getTokensGiven

public boolean[] getTokensGiven()
Get a copy of the tokens given.

Returns:
boolean array with the tokens given.