Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.parser.meta
Class MetaParser<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.parser.meta.MetaParser<O>
Type Parameters:
O - the type of DatabaseObject used in the ParsingResult retrieved by the base parser and provided in the ParsingResult of the Parser.parse(InputStream)-method of this Parser's subclass.
All Implemented Interfaces:
Parser<O>, Parameterizable
Direct Known Subclasses:
ProjectionParser, RandomProjectionParser

public abstract class MetaParser<O extends DatabaseObject>
extends AbstractParameterizable
implements Parser<O>

A MetaParser uses any Parser as specified by the user via parameter setting as base parser and may perform certain transformations on the retrieved ParsingResult.

Author:
Arthur Zimek

Field Summary
private  Parser<O> baseparser
          Holds an instance of the current base parser.
static OptionID BASEPARSER_ID
          OptionID for BASEPARSER_PARAM.
private  ClassParameter<? extends Parser<O>> BASEPARSER_PARAM
          The parameter for setting the base parser.
 
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
protected MetaParser()
          Sets the parameter for setting the base parser.
 
Method Summary
protected  ParsingResult<O> retrieveBaseParsingresult(InputStream in)
          Retrieves the ParsingResult of the base parser.
 List<String> setParameters(List<String> args)
          Grabs all specified options from the option handler.
 String toString()
          Returns a string representation of the object.
 
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, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.parser.Parser
parse
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, collectOptions, getParameters, shortDescription
 

Field Detail

BASEPARSER_ID

public static final OptionID BASEPARSER_ID
OptionID for BASEPARSER_PARAM.


BASEPARSER_PARAM

private final ClassParameter<? extends Parser<O extends DatabaseObject>> BASEPARSER_PARAM
The parameter for setting the base parser.

Key: -metaparser.baseparser

Default: DoubleVectorLabelParser


baseparser

private Parser<O extends DatabaseObject> baseparser
Holds an instance of the current base parser.

Constructor Detail

MetaParser

protected MetaParser()
Sets the parameter for setting the base parser.

Method Detail

retrieveBaseParsingresult

protected ParsingResult<O> retrieveBaseParsingresult(InputStream in)

Retrieves the ParsingResult of the base parser.

Parameters:
in - the InputStream to be parsed
Returns:
the ParsingResult of the base parser

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Description copied from class: AbstractParameterizable
Grabs all specified options from the option handler. Any extending class should call this method first and return the returned array without further changes, but after setting further required parameters. An example for overwriting this method taking advantage from the previously (in superclasses) defined options would be:

 {
   List remainingParameters = super.setParameters(args);
   // set parameters for your class
   // for example like this:
   if(isSet(MY_PARAM_VALUE_PARAM))
   {
      myParamValue = getParameterValue(MY_PARAM_VALUE_PARAM);
   }
   .
   .
   .
   return remainingParameters;
   // or in case of attributes requesting parameters themselves
   // return parameterizableAttribbute.setParameters(remainingParameters);
 }
 

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractParameterizable
Parameters:
args - parameters to set the attributes accordingly to
Returns:
a list containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting
See Also:
AbstractParameterizable.setParameters(java.util.List)

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.

Release 0.2.1 (2009-07-13_1605)