Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.database.connection
Class InputStreamDatabaseConnection<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<O>
              extended by de.lmu.ifi.dbs.elki.database.connection.InputStreamDatabaseConnection<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<O>, Parameterizable
Direct Known Subclasses:
FileBasedDatabaseConnection

public class InputStreamDatabaseConnection<O extends DatabaseObject>
extends AbstractDatabaseConnection<O>

Provides a database connection expecting input from an input stream such as stdin.

Author:
Arthur Zimek

Field Summary
(package private)  InputStream in
          The input stream to parse from.
(package private)  Parser<O> parser
          Holds the instance of the parser specified by PARSER_PARAM.
static OptionID PARSER_ID
          OptionID for PARSER_PARAM
private  ClassParameter<Parser<O>> PARSER_PARAM
          Parameter to specify the parser 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
InputStreamDatabaseConnection()
          Adds parameter PARSER_PARAM to the option handler additionally to parameters of super class.
 
Method Summary
 Database<O> getDatabase(Normalization<O> normalization)
          Returns a Database according to parameter settings.
 List<String> setParameters(List<String> args)
          Calls the super method and instantiates parser according to the value of parameter PARSER_PARAM.
 String shortDescription()
          Returns a short description of the class.
 
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
 
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
 

Field Detail

PARSER_ID

public static final OptionID PARSER_ID
OptionID for PARSER_PARAM


PARSER_PARAM

private final ClassParameter<Parser<O extends DatabaseObject>> PARSER_PARAM
Parameter to specify the parser to provide a database, must extend Parser.

Default value: DoubleVectorLabelParser

Key: -dbc.parser


parser

Parser<O extends DatabaseObject> parser
Holds the instance of the parser specified by PARSER_PARAM.


in

InputStream in
The input stream to parse from.

Constructor Detail

InputStreamDatabaseConnection

public InputStreamDatabaseConnection()
Adds parameter PARSER_PARAM to the option handler additionally to parameters of super class.

Method Detail

getDatabase

public Database<O> getDatabase(Normalization<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

shortDescription

public String shortDescription()
Description copied from class: AbstractParameterizable
Returns a short description of the class.

Specified by:
shortDescription in interface Parameterizable
Overrides:
shortDescription in class AbstractParameterizable
Returns:
Description of the class

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Calls the super method and instantiates parser according to the value of parameter PARSER_PARAM. The remaining parameters are passed to the parser.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractDatabaseConnection<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)