TUM CCSM Commons

edu.tum.cs.commons.options
Class CmdLine

java.lang.Object
  extended by edu.tum.cs.commons.options.CmdLine

Deprecated. Use the CommandLine class instead.

@Deprecated
public class CmdLine
extends java.lang.Object

A very simple class for parsing command line parameters.

A typical command line looks like this:

-dir src -count occurrences TEST -dde

In this example the minus symbol ('-') is the parameter prefix , dir,count and dde are parameters . Whereas dir has a single value src and count has the two value occurrences and TEST.

Typical method calls would have the following results.

method call result
hasParameter("dde") true
hasParameterAndValue("dde") false
hasParameter("TEST") false
getValue("src") "dir"
getValue("count") "occurrences"
getValues("count") ["occurrences", "TEST"]

Version:
$Rev: 26283 $
Author:
Florian Deissenboeck, $Author: juergens $
Rating:
GREEN Hash: 2C62BA90E8DC1F4D02B2E9BD96EB6A5E

Constructor Summary
CmdLine(java.lang.String[] params)
          Deprecated. Create new CmdLine -object from command line arguments.
CmdLine(java.lang.String[] params, java.lang.String parameterPrefix)
          Deprecated. Create new CmdLine -object from command line arguments.
 
Method Summary
 int getParameterCount()
          Deprecated. Get number of parameters.
 java.lang.String getValue(java.lang.String parameterName)
          Deprecated. Get the value for a parameter.
 java.lang.String[] getValues(java.lang.String parameterName)
          Deprecated. Get the values for a parameter.
 boolean hasParameter(java.lang.String parameterName)
          Deprecated. Checks if this command line has a certain parameter.
 boolean hasParameterAndValue(java.lang.String parameterName)
          Deprecated. Checks if this command line has a certain parameter with at least one value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmdLine

public CmdLine(java.lang.String[] params)
Deprecated. 
Create new CmdLine -object from command line arguments. Parameter prefix is "-".

Parameters:
params - command line arguments as provided in main() -method.

CmdLine

public CmdLine(java.lang.String[] params,
               java.lang.String parameterPrefix)
Deprecated. 
Create new CmdLine -object from command line arguments.

Parameters:
params - command line arguments as provided in main() -method.
parameterPrefix - parameter prefix
Method Detail

getParameterCount

public int getParameterCount()
Deprecated. 
Get number of parameters.

Returns:
number of parameters.

getValues

public java.lang.String[] getValues(java.lang.String parameterName)
Deprecated. 
Get the values for a parameter.

Parameters:
parameterName - name of the parameter.
Returns:
the values associated with this parameter. If the parameter is not present or doesn't habe a value null is returned.

getValue

public java.lang.String getValue(java.lang.String parameterName)
Deprecated. 
Get the value for a parameter.

Parameters:
parameterName - name of the parameter.
Returns:
the value associated with this parameter. If the parameter is not present or doesn't habe a value null is returned.

hasParameter

public boolean hasParameter(java.lang.String parameterName)
Deprecated. 
Checks if this command line has a certain parameter.

Parameters:
parameterName - name of the parameter
Returns:
true if parameter is present, false otherwise.

hasParameterAndValue

public boolean hasParameterAndValue(java.lang.String parameterName)
Deprecated. 
Checks if this command line has a certain parameter with at least one value.

Parameters:
parameterName - name of the parameter
Returns:
true if parameter and value is present, false otherwise.

TUM CCSM Commons

TUM CCSM Commons - 2.7