hultig.util
Class OSArguments

java.lang.Object
  extended by hultig.util.OSArguments

public class OSArguments
extends Object

NOT YET WELL COMMENTED. Command Line arguments handler

Description:

Copyright: JPC Copyright (c) Sep 2006

Company: UBI/HULTIG/SUMO


Constructor Summary
OSArguments(String[] args)
          Constructor
 
Method Summary
 boolean allDefined(String[] keys)
          Test if a set of arguments were defined.
 boolean contains(String label)
          Test if some argument exists, labeled or not
 String get(int i)
           
 String get(String param)
           
 Integer getInteger(String param)
          Tries to read an integer parameter.
 Integer getInteger(String param, int defaultValue)
          Tries to read am integer parameter, ensuring a default value.
 String getLabel(int i)
           
 int index(String label)
           
 double interpret(int i, double a)
          Intreprea o i-ésimo argumento como double.
 int interpret(int i, int a)
          Intrepreta o i-ésimo argumento como int.
 long interpret(int i, long a)
          Intreprea o i-ésimo argumento como long.
static void main(String[] args)
          The main method is used for testing.
 void printArgs()
          Outputs both argument types: positionals and labeled.
 int size()
          Total number of arguments.
 String toString()
          Overloading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OSArguments

public OSArguments(String[] args)
Constructor

Parameters:
args - String[]
Method Detail

contains

public boolean contains(String label)
Test if some argument exists, labeled or not

Parameters:
label - String
Returns:
boolean

index

public int index(String label)

get

public String get(String param)

getInteger

public Integer getInteger(String param)
Tries to read an integer parameter.

Parameters:
param - The parameter name.
Returns:
The read number or null.

getInteger

public Integer getInteger(String param,
                          int defaultValue)
Tries to read am integer parameter, ensuring a default value.

Parameters:
param - The name of the parameter to be read
defaultValue - The default value assumed.
Returns:
The parameter or the default value.

get

public String get(int i)

getLabel

public String getLabel(int i)

allDefined

public boolean allDefined(String[] keys)
Test if a set of arguments were defined.

Parameters:
keys - String[]
Returns:
boolean: true if yes.

interpret

public int interpret(int i,
                     int a)
Intrepreta o i-ésimo argumento como int.

Parameters:
i - int
a - int
Returns:
int

interpret

public long interpret(int i,
                      long a)
Intreprea o i-ésimo argumento como long.

Parameters:
i - int
a - long
Returns:
long

interpret

public double interpret(int i,
                        double a)
Intreprea o i-ésimo argumento como double.

Parameters:
i - int
a - double
Returns:
double

size

public int size()
Total number of arguments.

Returns:
int

printArgs

public void printArgs()
Outputs both argument types: positionals and labeled.


toString

public String toString()
Overloading.

Overrides:
toString in class Object
Returns:
String

main

public static void main(String[] args)
The main method is used for testing.

Parameters:
args - String[]