com.ibm.dtfj.analyzer.util
Class RuntimeParameters

java.lang.Object
  extended by com.ibm.dtfj.analyzer.util.RuntimeParameters

public class RuntimeParameters
extends java.lang.Object

A convenience class to simplify the handling of runtime parameters passed to the DumpAnalyzer. These parameters will either be the names of analysis modules or controls which govern the presentation of results. The latter will in general be preceded by the '-' char


Constructor Summary
RuntimeParameters(java.lang.String parameters)
          Build a parameter set from a set of strings.
RuntimeParameters(java.lang.String[] args, int start)
          Build a parameter set from a set of strings and starting from the given index where 0 is the first string.
 
Method Summary
 void addParameter(java.lang.String parm)
          Add a parameter to the current set.
 void clear()
          Remove all parameters
 int countAnalyzers()
          How many analyzers are defined in the parameters ?
 int countParameters()
          How many parameters are there - not including analyzers
 java.lang.String getAnalyzer(int indx)
          Return the name of the analyzer at position indx
 java.lang.String[] getAnalyzers()
          Get the names of all analyzers
 int getIntValue(int indx)
          Get the int value of the parameter at position indx Values are specified as parameterName=value
 int getIntValue(java.lang.String name, int defaultValue)
          Get the int value of the parameter at position indx Values are specified as parameterName=value If the parameter is undefined or has no value then return the given default
 java.lang.String getParameter(int indx)
          Get the parameter at the given position index
 int getParameterIndex(java.lang.String name)
          Get the index of the given named parameter or -1 if not found
 java.lang.String getValue(int indx)
          Get the string value of the parameter at position indx Values are specified as parameterName=value
 java.lang.String getValue(java.lang.String name, java.lang.String defaultValue)
          Get the string value of the parameter at position indx Values are specified as parameterName=value If the parameter is undefined or has no value then return the given default
 boolean parameterExists(java.lang.String name)
          Does the given paremeter name exist in the set
static java.lang.String[] splitParams(java.lang.String params)
          Split a string containing parameters into an array of parameters.
 java.lang.String toString()
          Return a string representation of the parameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuntimeParameters

public RuntimeParameters(java.lang.String[] args,
                         int start)
Build a parameter set from a set of strings and starting from the given index where 0 is the first string.

Parameters:
args - vector of string parameters
start - the first parameter to consider

RuntimeParameters

public RuntimeParameters(java.lang.String parameters)
Build a parameter set from a set of strings.

Parameters:
parameters - vector of string parameters
Method Detail

addParameter

public void addParameter(java.lang.String parm)
Add a parameter to the current set. Used to append things like logFile etc.

Parameters:
parm - the parameter to add

clear

public void clear()
Remove all parameters


countAnalyzers

public int countAnalyzers()
How many analyzers are defined in the parameters ?

Returns:
the count of analyzers

getAnalyzer

public java.lang.String getAnalyzer(int indx)
Return the name of the analyzer at position indx

Parameters:
indx - the analyzer to return
Returns:
the name of that analyzer

getAnalyzers

public java.lang.String[] getAnalyzers()
Get the names of all analyzers

Returns:
the vector of analyzer names

countParameters

public int countParameters()
How many parameters are there - not including analyzers

Returns:
total parameters

getParameter

public java.lang.String getParameter(int indx)
Get the parameter at the given position index

Parameters:
indx - the parameter index to return
Returns:
the value of that parameter

getParameterIndex

public int getParameterIndex(java.lang.String name)
Get the index of the given named parameter or -1 if not found

Parameters:
name - the name of the parameter to find
Returns:
the index or -1 if not found

parameterExists

public boolean parameterExists(java.lang.String name)
Does the given paremeter name exist in the set

Parameters:
name - the name to search for
Returns:
true if found else false.

getValue

public java.lang.String getValue(int indx)
Get the string value of the parameter at position indx Values are specified as parameterName=value

Parameters:
indx - the parameter index
Returns:
the string value of the parameter

getValue

public java.lang.String getValue(java.lang.String name,
                                 java.lang.String defaultValue)
Get the string value of the parameter at position indx Values are specified as parameterName=value If the parameter is undefined or has no value then return the given default

Parameters:
name - the parameter name
defaultValue - the default value if missing
Returns:
the string value of the parameter

getIntValue

public int getIntValue(int indx)
Get the int value of the parameter at position indx Values are specified as parameterName=value

Parameters:
indx - the parameter index
Returns:
the int value of the parameter

getIntValue

public int getIntValue(java.lang.String name,
                       int defaultValue)
Get the int value of the parameter at position indx Values are specified as parameterName=value If the parameter is undefined or has no value then return the given default

Parameters:
name - the parameter name
defaultValue - the default value if missing
Returns:
the int value of the parameter

toString

public java.lang.String toString()
Return a string representation of the parameters

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

splitParams

public static java.lang.String[] splitParams(java.lang.String params)
Split a string containing parameters into an array of parameters. This method supports parameters containing spaces by surrounding them with '"' and ''' characters or by putting '\' in front of a space similar to how it is done in command line shells.

Parameters:
params - a String containing parameters
Returns:
an array of strings each containing one parameter.


© Copyright IBM Corp. 2007, 2008 All Rights Reserved. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.