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 classFileListParameter.FilesTypeAvailable types of the files:FileListParameter.FilesType.INPUT_FILESdenotes input files,FileListParameter.FilesType.OUTPUT_FILESdenotes output files.
-
Field Summary
Fields Modifier and Type Field Description private FileListParameter.FilesTypefilesTypeSpecifies 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.StringgetDefaultValueAsString()Get the default value as string.java.lang.StringgetSyntax()Returns a string representation of the parameter's type.java.lang.StringgetValueAsString()Get the value as string.booleangrab(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.intsize()Size of the list.protected booleanvalidate(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:ParameterGet the value as string. May returnnull- Returns:
- Value as string
-
getDefaultValueAsString
public java.lang.String getDefaultValueAsString()
Description copied from interface:ParameterGet the default value as string.- Specified by:
getDefaultValueAsStringin interfaceParameter<java.util.List<java.net.URI>>- Overrides:
getDefaultValueAsStringin 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 ParameterExceptionDescription copied from class:AbstractParameterParse a given value into the destination type.- Specified by:
parseValuein 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 ParameterExceptionDescription copied from class:AbstractParameterValidate a value after parsing (e.g., do constraint checks!)- Overrides:
validatein 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:ListParameterSize of the list.- Specified by:
sizein 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:
trueif valid
-
-