Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.database.connection
Class MultipleFileBasedDatabaseConnection<O extends DatabaseObject>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
          extended by de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection<MultiRepresentedObject<O>>
              extended by de.lmu.ifi.dbs.elki.database.connection.MultipleFileBasedDatabaseConnection<O>
Type Parameters:
O - the type of DatabaseObject to be provided by the implementing class as element of the supplied database
All Implemented Interfaces:
DatabaseConnection<MultiRepresentedObject<O>>, Parameterizable

public class MultipleFileBasedDatabaseConnection<O extends DatabaseObject>
extends AbstractDatabaseConnection<MultiRepresentedObject<O>>

Provides a database connection based on multiple files and parsers to be set.

Author:
Elke Achtert

Field Summary
static OptionID INPUT_ID
          OptionID for INPUT_PARAM
private  FileListParameter INPUT_PARAM
          Parameter that specifies the names of the input files to be parsed.
private  List<InputStream> inputStreams
          The input files to parse from as specified by INPUT_PARAM.
private  List<Parser<O>> parsers
          Holds the instances of the parsers specified by PARSERS_PARAM.
static OptionID PARSERS_ID
          OptionID for PARSERS_PARAM
private  ClassListParameter<Parser<O>> PARSERS_PARAM
          Optional parameter to specify the parsers to provide a database, must extend Parser.
 
Fields inherited from class de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection
CLASS_LABEL_CLASS_ID, CLASS_LABEL_INDEX_ID, classLabelIndex, database, DATABASE_ID, EXTERNAL_ID_INDEX_ID, forceExternalID, LABEL_CONCATENATION
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
MultipleFileBasedDatabaseConnection()
          Provides a database connection expecting input from several files, adding parameters PARSERS_PARAM, and INPUT_PARAM to the option handler additionally to parameters of super class.
 
Method Summary
 Database<MultiRepresentedObject<O>> getDatabase(Normalization<MultiRepresentedObject<O>> normalization)
          Returns a Database according to parameter settings.
 List<String> setParameters(List<String> args)
          Calls the super method and instantiates inputStreams according to the value of parameter INPUT_PARAM and parsers according to the value of parameter PARSERS_PARAM .
 
Methods inherited from class de.lmu.ifi.dbs.elki.database.connection.AbstractDatabaseConnection
normalizeAndTransformLabels
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable, shortDescription
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, collectOptions, getParameters, shortDescription
 

Field Detail

PARSERS_ID

public static final OptionID PARSERS_ID
OptionID for PARSERS_PARAM


PARSERS_PARAM

private final ClassListParameter<Parser<O extends DatabaseObject>> PARSERS_PARAM
Optional parameter to specify the parsers to provide a database, must extend Parser. If this parameter is not set, DoubleVectorLabelParser is used as parser for all input files.

Key: -multipledbc.parsers


parsers

private List<Parser<O extends DatabaseObject>> parsers
Holds the instances of the parsers specified by PARSERS_PARAM.


INPUT_ID

public static final OptionID INPUT_ID
OptionID for INPUT_PARAM


INPUT_PARAM

private final FileListParameter INPUT_PARAM
Parameter that specifies the names of the input files to be parsed.

Key: -multipledbc.in


inputStreams

private List<InputStream> inputStreams
The input files to parse from as specified by INPUT_PARAM.

Constructor Detail

MultipleFileBasedDatabaseConnection

public MultipleFileBasedDatabaseConnection()
Provides a database connection expecting input from several files, adding parameters PARSERS_PARAM, and INPUT_PARAM to the option handler additionally to parameters of super class.

Method Detail

getDatabase

public Database<MultiRepresentedObject<O>> getDatabase(Normalization<MultiRepresentedObject<O>> normalization)
Description copied from interface: DatabaseConnection
Returns a Database according to parameter settings.

Parameters:
normalization - Normalization to perform a normalization if this action is supported. May remain null.
Returns:
a Database according to parameter settings

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Calls the super method and instantiates inputStreams according to the value of parameter INPUT_PARAM and parsers according to the value of parameter PARSERS_PARAM . The remaining parameters are passed to all instances of parsers.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractDatabaseConnection<MultiRepresentedObject<O extends DatabaseObject>>
Parameters:
args - parameters to set the attributes accordingly to
Returns:
a list containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting

Release 0.2 (2009-07-06_1820)