Class FileListParameter
- java.lang.Object
-
- elki.utilities.optionhandling.parameters.AbstractParameter<P,T>
-
- elki.utilities.optionhandling.parameters.ListParameter<FileListParameter,java.util.List<java.net.URI>>
-
- elki.utilities.optionhandling.parameters.FileListParameter
-
- All Implemented Interfaces:
Parameter<java.util.List<java.net.URI>>
public class FileListParameter extends ListParameter<FileListParameter,java.util.List<java.net.URI>>
Parameter class for a parameter specifying a list of files.- Since:
- 0.3
- Author:
- Steffi Wanka, Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileListParameter.FilesType
Available types of the files:FileListParameter.FilesType.INPUT_FILES
denotes input files,FileListParameter.FilesType.OUTPUT_FILES
denotes output files.
-
Field Summary
Fields Modifier and Type Field Description private FileListParameter.FilesType
filesType
Specifies the type of the files, i.e. if the files are input or output files.-
Fields inherited from class elki.utilities.optionhandling.parameters.ListParameter
LIST_SEP, SPLIT, VECTOR_SEP, VECTOR_SPLIT
-
Fields inherited from class elki.utilities.optionhandling.parameters.AbstractParameter
constraints, defaultValue, givenValue, optionalParameter, optionid
-
-
Constructor Summary
Constructors Constructor Description FileListParameter(OptionID optionID, FileListParameter.FilesType filesType)
Constructs a file list parameter with the given optionID, and file type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDefaultValueAsString()
Get the default value as string.java.lang.String
getSyntax()
Returns a string representation of the parameter's type.java.lang.String
getValueAsString()
Get the value as string.boolean
grab(Parameterization config, java.util.function.Consumer<java.util.List<java.net.URI>> consumer)
Get the parameter.protected java.util.List<java.net.URI>
parseValue(java.lang.Object obj)
Parse a given value into the destination type.int
size()
Size of the list.protected boolean
validate(java.util.List<java.net.URI> obj)
Validate a value after parsing (e.g., do constraint checks!)-
Methods inherited from class elki.utilities.optionhandling.parameters.AbstractParameter
addConstraint, describeValues, getConstraints, getDefaultValue, getOptionID, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setValue, setValueInternal, tookDefaultValue, tryDefaultValue
-
-
-
-
Field Detail
-
filesType
private FileListParameter.FilesType filesType
Specifies the type of the files, i.e. if the files are input or output files.
-
-
Constructor Detail
-
FileListParameter
public FileListParameter(OptionID optionID, FileListParameter.FilesType filesType)
Constructs a file list parameter with the given optionID, and file type.- Parameters:
optionID
- the unique id of this file list parameterfilesType
- the file type of this file list parameter
-
-
Method Detail
-
getValueAsString
public java.lang.String getValueAsString()
Description copied from interface:Parameter
Get the value as string. May returnnull
- Returns:
- Value as string
-
getDefaultValueAsString
public java.lang.String getDefaultValueAsString()
Description copied from interface:Parameter
Get the default value as string.- Specified by:
getDefaultValueAsString
in interfaceParameter<java.util.List<java.net.URI>>
- Overrides:
getDefaultValueAsString
in classAbstractParameter<FileListParameter,java.util.List<java.net.URI>>
- Returns:
- default value
-
parseValue
protected java.util.List<java.net.URI> parseValue(java.lang.Object obj) throws ParameterException
Description copied from class:AbstractParameter
Parse a given value into the destination type.- Specified by:
parseValue
in classAbstractParameter<FileListParameter,java.util.List<java.net.URI>>
- 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(java.util.List<java.net.URI> obj) throws ParameterException
Description copied from class:AbstractParameter
Validate a value after parsing (e.g., do constraint checks!)- Overrides:
validate
in classAbstractParameter<FileListParameter,java.util.List<java.net.URI>>
- Parameters:
obj
- Object to validate- Returns:
- true iff the object is valid for this parameter.
- Throws:
ParameterException
- when the object is not valid.
-
size
public int size()
Description copied from class:ListParameter
Size of the list.- Specified by:
size
in classListParameter<FileListParameter,java.util.List<java.net.URI>>
- Returns:
- Size
-
getSyntax
public java.lang.String getSyntax()
Returns a string representation of the parameter's type.- Returns:
- "<file_1,...,file_n>"
-
grab
public boolean grab(Parameterization config, java.util.function.Consumer<java.util.List<java.net.URI>> consumer)
Get the parameter.- Parameters:
config
- Parameterizationconsumer
- Output consumer- Returns:
true
if valid
-
-