de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters
Class FileParameter

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter<File,File>
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.FileParameter

public class FileParameter
extends Parameter<File,File>

Parameter class for a parameter specifying a file.


Nested Class Summary
static class FileParameter.FileType
          Available file types: FileParameter.FileType.INPUT_FILE denotes an input file, FileParameter.FileType.OUTPUT_FILE denotes an output file.
 
Field Summary
private  FileParameter.FileType fileType
          The file type of this file parameter.
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
 
Constructor Summary
FileParameter(OptionID optionID, FileParameter.FileType fileType)
          Constructs a file parameter with the given optionID, and file type.
FileParameter(OptionID optionID, FileParameter.FileType fileType, boolean optional)
          Constructs a file parameter with the given optionID, file type, and optional flag.
 
Method Summary
 String getSyntax()
          Returns a string representation of the parameter's type.
 String getValueAsString()
          Get the value as string.
protected  File parseValue(Object obj)
          Parse a given value into the destination type.
protected  boolean validate(File obj)
          Validate a value after parsing (e.g. do constrain checks!)
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.parameters.Parameter
addConstraint, getDefaultValue, getDefaultValueAsString, getFullDescription, getGivenValue, getName, getOptionID, getShortDescription, getValue, getValuesDescription, hasDefaultValue, hasValuesDescription, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileType

private FileParameter.FileType fileType
The file type of this file parameter. Specifies if the file is an input of output file.

Constructor Detail

FileParameter

public FileParameter(OptionID optionID,
                     FileParameter.FileType fileType)
Constructs a file parameter with the given optionID, and file type.

Parameters:
optionID - optionID the unique id of the option
fileType - the file type of this file parameter

FileParameter

public FileParameter(OptionID optionID,
                     FileParameter.FileType fileType,
                     boolean optional)
Constructs a file parameter with the given optionID, file type, and optional flag.

Parameters:
optionID - optionID the unique id of the option
fileType - the file type of this file parameter
optional - specifies if this parameter is an optional parameter
Method Detail

getValueAsString

public String getValueAsString()
Get the value as string. May return null

Specified by:
getValueAsString in class Parameter<File,File>
Returns:
Value as string

parseValue

protected File parseValue(Object obj)
                   throws ParameterException
Parse a given value into the destination type.

Specified by:
parseValue in class Parameter<File,File>
Parameters:
obj - Object to parse (may be a string representation!)
Returns:
Parsed object
Throws:
ParameterException - when the object cannot be parsed.

validate

protected boolean validate(File obj)
                    throws ParameterException
Validate a value after parsing (e.g. do constrain checks!)

Overrides:
validate in class Parameter<File,File>
Parameters:
obj - Object to validate
Returns:
true iff the object is valid for this parameter.
Throws:
ParameterException - when the object is not valid.

getSyntax

public String getSyntax()
Returns a string representation of the parameter's type.

Specified by:
getSyntax in class Parameter<File,File>
Returns:
"<file_>"

Release 0.4.0 (2011-09-20_1324)