Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.application
Class GeneratorXMLSpec

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.application.AbstractApplication
          extended by de.lmu.ifi.dbs.elki.application.StandAloneApplication
              extended by de.lmu.ifi.dbs.elki.application.GeneratorXMLSpec
All Implemented Interfaces:
Parameterizable

public class GeneratorXMLSpec
extends StandAloneApplication

Generate a data set based on a specified model (using an XML specification)

Author:
Erich Schubert

Field Summary
private  Random clusterRandom
          Random generator used for initializing cluster generators.
static OptionID CONFIGFILE_ID
          OptionID for CONFIGFILE_PARAM
private  FileParameter CONFIGFILE_PARAM
          Parameter to give the configuration file
 GeneratorMain gen
          The actual generator class
private static String GENERATOR_SCHEMA_FILE
          File name of the generators XML Schema file.
static OptionID RANDOMSEED_ID
          OptionID for RANDOMSEED_PARAM
private  IntParameter RANDOMSEED_PARAM
          Parameter to give the configuration file
static OptionID SIZE_SCALE_ID
          OptionID for SIZE_SCALE_PARAM
private  DoubleParameter SIZE_SCALE_PARAM
          Parameter to give the configuration file
(package private)  double sizescale
          Parameter for scaling the cluster sizes.
(package private)  File specfile
          The configuration file.
private  boolean testAgainstModel
          Set testAgainstModel flag
static Pattern WHITESPACE_PATTERN
          A pattern defining whitespace.
 
Fields inherited from class de.lmu.ifi.dbs.elki.application.StandAloneApplication
OUTPUT_ID
 
Fields inherited from class de.lmu.ifi.dbs.elki.application.AbstractApplication
config, INFORMATION, STATIC_LOGGER
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
GeneratorXMLSpec(Parameterization config)
          Constructor, adhering to Parameterizable
 
Method Summary
 String getOutputDescription()
          Describe wrapper output.
private  void loadXMLSpecification(File specfile)
          Load the XML configuration file.
static void main(String[] args)
          Main method to run this wrapper.
private  Vector parseVector(String s)
          Parse a string into a vector.
private  void processElementClipping(GeneratorSingleCluster cluster, Node cur)
          Process a 'clipping' Element in the XML stream.
private  void processElementCluster(Node cur)
          Process a 'cluster' Element in the XML stream.
private  void processElementDataset(Node cur)
          Process a 'dataset' Element in the XML stream.
private  void processElementNormal(GeneratorSingleCluster cluster, Node cur)
          Process a 'normal' Element in the XML stream.
private  void processElementPoint(LinkedList<Vector> points, Node cur)
          Parse a 'point' element (point vector for a static cluster)
private  void processElementRotate(GeneratorSingleCluster cluster, Node cur)
          Process a 'rotate' Element in the XML stream.
private  void processElementStatic(Node cur)
          Process a 'static' cluster Element in the XML stream.
private  void processElementTranslate(GeneratorSingleCluster cluster, Node cur)
          Process a 'translate' Element in the XML stream.
private  void processElementUniform(GeneratorSingleCluster cluster, Node cur)
          Process a 'uniform' Element in the XML stream.
 void run()
          Runs the wrapper with the specified arguments.
 
Methods inherited from class de.lmu.ifi.dbs.elki.application.StandAloneApplication
getOutput
 
Methods inherited from class de.lmu.ifi.dbs.elki.application.AbstractApplication
isVerbose, printErrorMessage, runCLIApplication, usage
 
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
 

Field Detail

WHITESPACE_PATTERN

public static final Pattern WHITESPACE_PATTERN
A pattern defining whitespace.


CONFIGFILE_ID

public static final OptionID CONFIGFILE_ID
OptionID for CONFIGFILE_PARAM


CONFIGFILE_PARAM

private final FileParameter CONFIGFILE_PARAM
Parameter to give the configuration file


RANDOMSEED_ID

public static final OptionID RANDOMSEED_ID
OptionID for RANDOMSEED_PARAM


RANDOMSEED_PARAM

private final IntParameter RANDOMSEED_PARAM
Parameter to give the configuration file


SIZE_SCALE_ID

public static final OptionID SIZE_SCALE_ID
OptionID for SIZE_SCALE_PARAM


SIZE_SCALE_PARAM

private final DoubleParameter SIZE_SCALE_PARAM
Parameter to give the configuration file


GENERATOR_SCHEMA_FILE

private static final String GENERATOR_SCHEMA_FILE
File name of the generators XML Schema file.


specfile

File specfile
The configuration file.


sizescale

double sizescale
Parameter for scaling the cluster sizes.


gen

public GeneratorMain gen
The actual generator class


clusterRandom

private Random clusterRandom
Random generator used for initializing cluster generators.


testAgainstModel

private boolean testAgainstModel
Set testAgainstModel flag

Constructor Detail

GeneratorXMLSpec

public GeneratorXMLSpec(Parameterization config)
Constructor, adhering to Parameterizable

Parameters:
config - Parameterization
Method Detail

loadXMLSpecification

private void loadXMLSpecification(File specfile)
                           throws UnableToComplyException
Load the XML configuration file.

Throws:
UnableToComplyException

processElementDataset

private void processElementDataset(Node cur)
                            throws UnableToComplyException
Process a 'dataset' Element in the XML stream.

Parameters:
cur - Current document nod
Throws:
UnableToComplyException

processElementCluster

private void processElementCluster(Node cur)
                            throws UnableToComplyException
Process a 'cluster' Element in the XML stream.

Parameters:
cur - Current document nod
Throws:
UnableToComplyException

processElementUniform

private void processElementUniform(GeneratorSingleCluster cluster,
                                   Node cur)
                            throws UnableToComplyException
Process a 'uniform' Element in the XML stream.

Parameters:
cluster -
cur - Current document nod
Throws:
UnableToComplyException

processElementNormal

private void processElementNormal(GeneratorSingleCluster cluster,
                                  Node cur)
                           throws UnableToComplyException
Process a 'normal' Element in the XML stream.

Parameters:
cluster -
cur - Current document nod
Throws:
UnableToComplyException

processElementRotate

private void processElementRotate(GeneratorSingleCluster cluster,
                                  Node cur)
                           throws UnableToComplyException
Process a 'rotate' Element in the XML stream.

Parameters:
cluster -
cur - Current document nod
Throws:
UnableToComplyException

processElementTranslate

private void processElementTranslate(GeneratorSingleCluster cluster,
                                     Node cur)
                              throws UnableToComplyException
Process a 'translate' Element in the XML stream.

Parameters:
cluster -
cur - Current document nod
Throws:
UnableToComplyException

processElementClipping

private void processElementClipping(GeneratorSingleCluster cluster,
                                    Node cur)
                             throws UnableToComplyException
Process a 'clipping' Element in the XML stream.

Parameters:
cluster -
cur - Current document nod
Throws:
UnableToComplyException

processElementStatic

private void processElementStatic(Node cur)
                           throws UnableToComplyException
Process a 'static' cluster Element in the XML stream.

Parameters:
cur - Current document nod
Throws:
UnableToComplyException

processElementPoint

private void processElementPoint(LinkedList<Vector> points,
                                 Node cur)
                          throws UnableToComplyException
Parse a 'point' element (point vector for a static cluster)

Parameters:
points - current list of points (to append to)
cur - Current document nod
Throws:
UnableToComplyException

parseVector

private Vector parseVector(String s)
                    throws UnableToComplyException
Parse a string into a vector. TODO: move this into utility package?

Parameters:
s - String to parse
Returns:
Vector
Throws:
UnableToComplyException

run

public void run()
         throws UnableToComplyException
Runs the wrapper with the specified arguments.

Specified by:
run in class AbstractApplication
Throws:
UnableToComplyException - if an error occurs during running the application

getOutputDescription

public String getOutputDescription()
Describe wrapper output.

Specified by:
getOutputDescription in class StandAloneApplication
Returns:
the description for the output parameter

main

public static void main(String[] args)
Main method to run this wrapper.

Parameters:
args - the arguments to run this wrapper

Release 0.3 (2010-03-31_1612)