edu.rice.cs.drjava.config
Class VectorOption

java.lang.Object
  |
  +--edu.rice.cs.drjava.config.OptionParser
        |
        +--edu.rice.cs.drjava.config.Option
              |
              +--edu.rice.cs.drjava.config.VectorOption
All Implemented Interfaces:
FormatStrategy, ParseStrategy

public class VectorOption
extends Option

Abstract class defining behavior shared by all configuration options with values of type Vector.

Version:
$Id: VectorOption.java,v 1.6 2002/07/11 23:19:30 cmcgraw Exp $

Field Summary
 char delim
           
 String footer
           
protected  FormatStrategy formatter
           
 String header
           
protected  ParseStrategy parser
           
 
Fields inherited from class edu.rice.cs.drjava.config.Option
listeners
 
Fields inherited from class edu.rice.cs.drjava.config.OptionParser
defaultValue, map, name
 
Constructor Summary
  VectorOption(String key, Option strategy, String header, char delim, String footer, gj.util.Vector def)
           
  VectorOption(String key, Option option, gj.util.Vector def)
          Defaults the "header", "footer", and "delim" fields to open bracket, close bracket, and comma, repsectively.
private VectorOption(String key, ParseStrategy parser, FormatStrategy formatter, String header, char delim, String footer, gj.util.Vector def)
           
 
Method Summary
 String format(Object x0)
          the ability to format a statically typed T value to a String.
 String format(gj.util.Vector v)
           
 Object getDefault()
           
(package private)  Object getOption(DefaultOptionMap x0)
          the accessor for the magic-typed hashtable stunt.
(package private)  void notifyListeners(Configuration x0, Object x1)
           
 gj.util.Vector parse(String s)
          the ability to parse a string to an object of type T.
 gj.util.Vector parse(String s)
          the ability to parse a string to an object of type T.
(package private)  Object remove(DefaultOptionMap x0)
          the destructor for a mapping in the magic-typed hashtable.
(package private)  Object setOption(DefaultOptionMap x0, Object x1)
          the mutator for the magic-typed hashtable stunt.
(package private)  Object setString(DefaultOptionMap x0, String x1)
          uses parse() and setOption() so that any changes in parsing will automatically be applied to setString().
 
Methods inherited from class edu.rice.cs.drjava.config.Option
addListener, getDefaultString, getString, removeListener
 
Methods inherited from class edu.rice.cs.drjava.config.OptionParser
getName
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

parser

protected ParseStrategy parser

formatter

protected FormatStrategy formatter

header

public final String header

delim

public final char delim

footer

public final String footer
Constructor Detail

VectorOption

private VectorOption(String key,
                     ParseStrategy parser,
                     FormatStrategy formatter,
                     String header,
                     char delim,
                     String footer,
                     gj.util.Vector def)
Parameters:
key - The name of this option.
parser - the parsing strategy for an element in this option
formatter - the formatting strategy for an element in this option

VectorOption

public VectorOption(String key,
                    Option strategy,
                    String header,
                    char delim,
                    String footer,
                    gj.util.Vector def)

VectorOption

public VectorOption(String key,
                    Option option,
                    gj.util.Vector def)
Defaults the "header", "footer", and "delim" fields to open bracket, close bracket, and comma, repsectively.
Parameters:
key - The name of this option.
option - The object that knows how to parse and format an element of type T.
Method Detail

parse

public gj.util.Vector parse(String s)
Description copied from class: OptionParser
the ability to parse a string to an object of type T. All concrete versions of this class must override this method to provide some sort of parser implementation.
Overrides:
parse in class OptionParser
Parameters:
s - The String to be parsed.
Returns:
An instance of Vector represented by "s".
Throws:
IllegalArgumentException - if "s" is not formatted according to the method Vector.toString().

format

public String format(gj.util.Vector v)
Parameters:
v - The Vector to be formatted.
Returns:
A String representing "v". The overall String format is determined by the method Vector.tString(), but each element of the vector is formatted by calling formatElement().

notifyListeners

void notifyListeners(Configuration x0,
                     Object x1)
Overrides:
notifyListeners in class Option

format

public String format(Object x0)
Description copied from class: Option
the ability to format a statically typed T value to a String. Since T is an Object, the default implementation uses the .toString() method.
Overrides:
format in class Option
Following copied from class: edu.rice.cs.drjava.config.Option
Parameters:
value - the statically-typed value to format into a String
Throws:
NullPointerException - if value is null

remove

Object remove(DefaultOptionMap x0)
Description copied from class: OptionParser
the destructor for a mapping in the magic-typed hashtable.
Overrides:
remove in class OptionParser

setOption

Object setOption(DefaultOptionMap x0,
                 Object x1)
Description copied from class: OptionParser
the mutator for the magic-typed hashtable stunt.
Overrides:
setOption in class OptionParser

getOption

Object getOption(DefaultOptionMap x0)
Description copied from class: OptionParser
the accessor for the magic-typed hashtable stunt.
Overrides:
getOption in class OptionParser

setString

Object setString(DefaultOptionMap x0,
                 String x1)
Description copied from class: OptionParser
uses parse() and setOption() so that any changes in parsing will automatically be applied to setString().
Overrides:
setString in class OptionParser

parse

public gj.util.Vector parse(String s)
Description copied from class: OptionParser
the ability to parse a string to an object of type T. All concrete versions of this class must override this method to provide some sort of parser implementation.
Overrides:
parse in class OptionParser
Parameters:
s - The String to be parsed.
Returns:
An instance of Vector represented by "s".
Throws:
IllegalArgumentException - if "s" is not formatted according to the method Vector.toString().

getDefault

public Object getDefault()
Overrides:
getDefault in class OptionParser
Following copied from class: edu.rice.cs.drjava.config.OptionParser
Returns:
the default value