Table of Contents
This chapter will discuss some of the important utility classes that can be
helpful in commonly encountered contexts while working with the Tensegrity API. All
of these classes can be found in package
com.tensegrity.generic.util.
Applications and Applets often have to be provided
with parameters passed to them at startup. Class CommandLine can
be used to parse such arguments via the command line (Application) or parameter
tags (Applet).
The arguments are described in the array possibleValues. The expected format of this array is described here:
- Parameter name ([][0]): Name of the parameter without the leading -. - Optional (Boolean) ([][1]):TRUE, if this parameter is mandatory. - Default value ([][2]): The default value, if the no value for this parameter is specified. - Usage text ([][3]): A short description telling what this option does
When creating an CommandLine instance, be aware of the defined
sequence of parameters in the 2-dimensional array (the second parameter of a
particular constructor).
Example 20.1.
Making use of the CommandLine class:
Object[][] commands= {
{ "help", Boolean.FALSE, null, "this help message."},
{ "test", Boolean.FALSE, "1234", "the String to be dumped."}};
try
{
CommandLine cl= new CommandLine(args, commands);
System.out.println(cl.get("test"));
}
catch(ParseException e)
{
if(Debug.DISPLAY_THROWABLES)
System.err.println(e);
}
© 2004, 2005 Tensegrity Software GmbH