edu.rice.cs.drjava.config
Class VectorOption<T>
java.lang.Object
edu.rice.cs.drjava.config.OptionParser<T>
edu.rice.cs.drjava.config.Option<Vector<T>>
edu.rice.cs.drjava.config.VectorOption<T>
- All Implemented Interfaces:
- FormatStrategy<Vector<T>>, ParseStrategy<Vector<T>>
public class VectorOption<T>
- extends Option<Vector<T>>
Abstract class defining behavior shared by all
configuration options with values of type
Vector.
VectorOption now allows empty strings, i.e. "[,]" is a vector of two empty strings.
"[]" will be interpreted as a vector of one empty string, and "" is an empty vector.
- Version:
- $Id: VectorOption.java 4504 2008-06-03 06:19:20Z rcartwright $
Constructor Summary |
VectorOption(String key,
Option<T> strategy,
String header,
char delim,
String footer,
Vector<T> def)
|
VectorOption(String key,
Option<T> option,
Vector<T> def)
Defaults the "header", "footer", and "delim" fields
to open bracket, close bracket, and comma, repsectively. |
parser
protected ParseStrategy<T> parser
formatter
protected FormatStrategy<T> formatter
header
public final String header
delim
public final char delim
footer
public final String footer
VectorOption
public VectorOption(String key,
Option<T> strategy,
String header,
char delim,
String footer,
Vector<T> def)
VectorOption
public VectorOption(String key,
Option<T> option,
Vector<T> 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.
parse
public Vector<T> 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.
- Specified by:
parse
in interface ParseStrategy<Vector<T>>
- Specified by:
parse
in class OptionParser<Vector<T>>
- 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(Vector<T> v)
- Formats the Vector v. The overall String format is determined by the method Vector.tString(), but each
element of the vector is formatted by calling formatElement().
- Specified by:
format
in interface FormatStrategy<Vector<T>>
- Overrides:
format
in class Option<Vector<T>>
- Parameters:
v
- The Vector to be formatted.
- Returns:
- A String representing "v".