Logo Search packages:      
Sourcecode: jabref version File versions  Download package

gnu::dtools::ritopt::Option Class Reference

Inheritance diagram for gnu::dtools::ritopt::Option:

gnu::dtools::ritopt::OptionModifiable gnu::dtools::ritopt::ArrayOption gnu::dtools::ritopt::BooleanOption gnu::dtools::ritopt::ByteOption gnu::dtools::ritopt::CharOption gnu::dtools::ritopt::DoubleOption gnu::dtools::ritopt::FloatOption gnu::dtools::ritopt::IntOption gnu::dtools::ritopt::LongOption gnu::dtools::ritopt::NotifyOption gnu::dtools::ritopt::ShortOption gnu::dtools::ritopt::StringOption

List of all members.


Detailed Description

Option.java

Version

Id
Option.java 2209 2007-08-01 18:23:38Z coezbek
This is the principal base class for all Option classes. It contains constructors for short and long option initialization, utility members for help reporting and file writing, and deprecation facilities.

Options that provide array support should inherit from the ArrayOption class, and follow the guidelines defined both in the Option and ArrayOption class descriptions.

Non-abstract subclasses should implement the modify method. When an option is invoked, the value of the option is passed to the modify method.

Subclasses should provide several constructors so that registration is simple and uniform. Recommended constructors include a default constructor, an interface for initialization of short and long options, and one that allows both short and long option fields to be initialized. If the subclass implementation provides constructors which initialize its members then the member parameters must be before the short and long option initialization parameters.

Event driven option processing is provided in the NotifyOption class. In order to use a NotifyOption, the recipient object must implement the OptionListener class. Although it is not required, subclass implementations of NotifyOption should implement the OptionNotifier interface.

By default, the Option class considers the width of an output device to be eighty characters. It initializes the width of the help fields based on this figure. If a field exceeds its field width, it is truncated. The width constraints can be changed by invoking the appropriate static mutators.

Similar to the help reporting facilities, the same constraints are placed on the listing of options provided by the built-in menu interface. These constraints can be modified by executing the appropriate static mutators.

The Option class provides a facility for writing options files. For option file writing, there are only two field width constraints; the assignment and the comment.

 Assignment:                           Comment:
 --longOrShortOption=optionValue       ;description goes here [d]
 
As shown above, an assignment includes the long or short option text, an equal sign, and the option's value. The comment includes the description, and "[d]" if the option is deprecated.

If the assignment exceeds its field width, the comment is placed before the assignment on a separate line. The comment is truncated if it exceeds eighty characters when it is placed before the assignment. However, if the assignment does not exceeds its field width and the comment does, the comment is truncated, and continued on the next line at the columnar position defined by the assignment's field width. Field widths may be modified by invoking the appropriate static mutator.

This class also provides a facility for deprecating options. An option is deprecated to discourage its use without removing the functionality it provides. An option is deprecated by invoking the deprecate method.


 Copyright (C) Damian Ryan Eads, 2001. All Rights Reserved.

 ritopt is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 ritopt is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with ritopt; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 

Author:
Damian Eads

Definition at line 92 of file Option.java.


Public Member Functions

void action ()
void deprecate ()
String getDescription ()
String getHashKey ()
String getHelp ()
String getHelpDeprecated ()
String getHelpDescription ()
String getHelpOptionSpecification ()
String getHelpTypeName ()
String getLongOption ()
String getName ()
abstract Object getObject ()
String getOptionFileLine ()
char getShortOption ()
abstract String getStringValue ()
abstract String getTypeName ()
boolean isDeprecated ()
boolean isInvoked ()
 Option (String longOption, char shortOption)
 Option (char shortOption)
 Option (String longOption)
 Option (Option option)
 Option ()
void setDeprecated (boolean deprecated)
void setDescription (String description)
void setInvoked (boolean b)
void setKey (char shortOption)
void setKey (String longOption)
void setLongOption (String longOption)
void setShortOption (char shortOption)

Static Public Member Functions

static int getFileCommentSize ()
static int getFileCompleteOptionSize ()
static String getHashKey (String longOption, char shortOption)
static String getHashKey (char shortOption)
static String getHashKey (String longOption)
static int getHelpDeprecatedSize ()
static int getHelpDescriptionSize ()
static String getHelpHeader ()
static int getHelpOptionSpecificationSize ()
static int getHelpTypenameSize ()
static int getMenuDeprecatedSize ()
static int getMenuDescriptionSize ()
static int getMenuOptionSpecificationSize ()
static int getMenuTypenameSize ()
static void setFileCommentSize (int newSize)
static void setFileCompleteOptionSize (int newSize)
static void setHelpDeprecatedSize (int newSize)
static void setHelpDescriptionSize (int newSize)
static void setHelpOptionSpecificationSize (int newSize)
static void setHelpTypenameSize (int newSize)
static void setMenuDeprecatedSize (int newSize)
static void setMenuDescriptionSize (int newSize)
static void setMenuOptionSpecificationSize (int newSize)
static void setMenuTypenameSize (int newSize)

Static Public Attributes

static final int DEFAULT_FILE_COMMENT_SIZE = 16
static final int DEFAULT_FILE_COMPLETE_OPTION_SIZE = 60
static final int DEFAULT_HELP_DEPRECATED_SIZE = 3
static final int DEFAULT_HELP_DESCRIPTION_SIZE = 48
static final int DEFAULT_HELP_OPTION_SIZE = 22
static final int DEFAULT_HELP_TYPENAME_SIZE = 10
static final int DEFAULT_MENU_DEPRECATED_SIZE = 3
static final int DEFAULT_MENU_DESCRIPTION_SIZE = 48
static final int DEFAULT_MENU_OPTION_SIZE = 15
static final int DEFAULT_MENU_TYPENAME_SIZE = 10

Protected Attributes

boolean invoked

Package Functions

void modify (String value) throws OptionModificationException

Private Attributes

boolean deprecated
String description
String longOption
char shortOption

Static Private Attributes

static int fileCommentSize = DEFAULT_FILE_COMMENT_SIZE
static int fileCompleteOptionSize
static int helpDeprecatedSize = DEFAULT_HELP_DEPRECATED_SIZE
static int helpDescriptionSize = DEFAULT_HELP_DESCRIPTION_SIZE
static int helpOptionSpecificationSize = DEFAULT_HELP_OPTION_SIZE
static int helpTypenameSize = DEFAULT_HELP_TYPENAME_SIZE
static int menuDeprecatedSize = DEFAULT_MENU_DEPRECATED_SIZE
static int menuDescriptionSize = DEFAULT_MENU_DESCRIPTION_SIZE
static int menuOptionSpecificationSize = DEFAULT_MENU_OPTION_SIZE
static int menuTypenameSize = DEFAULT_MENU_TYPENAME_SIZE

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index