gnu.classpath.tools.getopt
Class OptionGroup

java.lang.Object
  extended by gnu.classpath.tools.getopt.OptionGroup

public class OptionGroup
extends Object

An option group holds a collection of Options. It also has a name. Option groups are primarily useful for grouping help output.


Field Summary
private static String FILLER
          An 80-character string of whitespaces to use as a source for padding.
private  String name
           
(package private)  ArrayList options
           
 
Constructor Summary
OptionGroup()
          Create a new nameless option group.
OptionGroup(String name)
          Create a new option group with the indicated name.
 
Method Summary
 void add(Option opt)
          Add an option to this option group.
protected static void formatText(PrintStream out, String text, int leftMargin)
          Print a designated text to a PrintStream, eventually wrapping the lines of text so as to ensure that the width of each line does not overflow Parser.MAX_LINE_LENGTH columns.
protected static void formatText(PrintStream out, String text, int leftMargin, Locale aLocale)
          Similar to the method with the same name and three arguments, except that the caller MUST specify a non-null Locale instance.
 void printHelp(PrintStream out, boolean longOnly)
          Print the help output for this option group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILLER

private static final String FILLER
An 80-character string of whitespaces to use as a source for padding.

See Also:
Constant Field Values

name

private String name

options

ArrayList options
Constructor Detail

OptionGroup

OptionGroup()
Create a new nameless option group. This can only be used by Parser.


OptionGroup

public OptionGroup(String name)
Create a new option group with the indicated name.

Parameters:
name - the name
Method Detail

formatText

protected static void formatText(PrintStream out,
                                 String text,
                                 int leftMargin)
Print a designated text to a PrintStream, eventually wrapping the lines of text so as to ensure that the width of each line does not overflow Parser.MAX_LINE_LENGTH columns. The line-wrapping is done with a BreakIterator using the default Locale.

The text to print may contain \n characters. This method will force a line-break for each such character.

Parameters:
out - the PrintStream destination of the formatted text.
text - the text to print.
leftMargin - a positive value indicating the column position of the start of the first line. Continuation lines, if they exist, are printed starting at leftMargin + 2 as per GNU convention.
See Also:
Parser.MAX_LINE_LENGTH

formatText

protected static void formatText(PrintStream out,
                                 String text,
                                 int leftMargin,
                                 Locale aLocale)
Similar to the method with the same name and three arguments, except that the caller MUST specify a non-null Locale instance.

Print a designated text to a PrintStream, eventually wrapping the lines of text so as to ensure that the width of each line does not overflow Parser.MAX_LINE_LENGTH columns. The line-wrapping is done with a BreakIterator using the designated Locale.

The text to print may contain \n characters. This method will force a line-break for each such character.

Parameters:
out - the PrintStream destination of the formatted text.
text - the text to print.
leftMargin - a positive value indicating the column position of the start of the first line. Continuation lines, if they exist, are printed starting at leftMargin + 2 as per GNU convention.
aLocale - the Locale instance to use when constructing the BreakIterator.
See Also:
Parser.MAX_LINE_LENGTH

add

public void add(Option opt)
Add an option to this option group.

Parameters:
opt - the option to add

printHelp

public void printHelp(PrintStream out,
                      boolean longOnly)
Print the help output for this option group.

Parameters:
out - the stream to which to print