avrora.util.help
Class HelpCategory

java.lang.Object
  extended byavrora.util.help.HelpCategory
All Implemented Interfaces:
HelpItem
Direct Known Subclasses:
Action, MonitorFactory, ProgramReader, Simulation

public class HelpCategory
extends java.lang.Object
implements HelpItem

The HelpCategory class implements a category that provides help from the command line. It can contain multiple sections, including sections on options, and a list of other help items (such as what the values of each option does).


Field Summary
static java.util.Comparator COMPARATOR
           
 java.lang.String help
           
 java.lang.String name
           
 
Constructor Summary
HelpCategory(java.lang.String name, java.lang.String help)
          The constructor for the HelpCategory class creates a new help category with the specified short name and the specified default help.
 
Method Summary
 void addCommandExample(java.lang.String prefix, java.lang.String command)
          The addCommandExample() method adds a command example, properly formatted, to this section.
 void addListSection(java.lang.String title, java.lang.String para, java.util.List l)
          The addListSection() method adds a new section to this help category with the specified list of help items.
 void addOptionSection(java.lang.String para, Options opts)
          The addOptionSection() method adds a new section to this help category with the specified options.
 void addSection(java.lang.String title, java.lang.String paragraph)
          The addSection() method adds a new section to this help category with the specified title and a paragraph that is automatically formatted when printed out.
 void addSubcategorySection(java.lang.String title, java.lang.String para, java.util.List l)
          The addSubcategorySection method adds a new section that is a list of subcategories under this main category.
 java.lang.String getHelp()
          The getHelp() method returns a string representing help for this help item.
 java.lang.String getName()
          The getName() method returns the short name for this help category.
 void printHelp()
          The printHelp() method prints out all of the help sections in order for this category.
 void setName(java.lang.String nm)
          The setName() method is used to set the short name for this help category.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name

help

public final java.lang.String help

COMPARATOR

public static final java.util.Comparator COMPARATOR
Constructor Detail

HelpCategory

public HelpCategory(java.lang.String name,
                    java.lang.String help)
The constructor for the HelpCategory class creates a new help category with the specified short name and the specified default help.

Parameters:
name - the short name of this category (where it is accessible from the command line)
help - the help description for this category
Method Detail

getHelp

public java.lang.String getHelp()
The getHelp() method returns a string representing help for this help item.

Specified by:
getHelp in interface HelpItem
Returns:
a help string for this item

getName

public java.lang.String getName()
The getName() method returns the short name for this help category. This short name is used to add this help category to the global help category database.

Returns:
the short name of this help category

setName

public void setName(java.lang.String nm)
The setName() method is used to set the short name for this help category.

Parameters:
nm - the new short name for this category

addSection

public void addSection(java.lang.String title,
                       java.lang.String paragraph)
The addSection() method adds a new section to this help category with the specified title and a paragraph that is automatically formatted when printed out.

Parameters:
title - the title of the new section
paragraph - a long string representing the text for this section

addOptionSection

public void addOptionSection(java.lang.String para,
                             Options opts)
The addOptionSection() method adds a new section to this help category with the specified options. The new section will contain a paragraph description of the options and list the options in alphabetical order.

Parameters:
para - a summary of the options
opts - the options for this help category

addListSection

public void addListSection(java.lang.String title,
                           java.lang.String para,
                           java.util.List l)
The addListSection() method adds a new section to this help category with the specified list of help items.

Parameters:
title - the title of the new sectiobn
para - a paragraph description of the section
l - a list of HelpItem instances that will be added to the end of the section

addSubcategorySection

public void addSubcategorySection(java.lang.String title,
                                  java.lang.String para,
                                  java.util.List l)
The addSubcategorySection method adds a new section that is a list of subcategories under this main category.

Parameters:
title - the title of the section
para - a paragraph description of this section
l - a list of subcategories

addCommandExample

public void addCommandExample(java.lang.String prefix,
                              java.lang.String command)
The addCommandExample() method adds a command example, properly formatted, to this section.

Parameters:
prefix - a string that is the prefix to the command line
command - the command line example to add

printHelp

public void printHelp()
The printHelp() method prints out all of the help sections in order for this category.

Specified by:
printHelp in interface HelpItem