Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.result.textwriter
Class TextWriter<O extends DatabaseObject>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.result.textwriter.TextWriter<O>
Type Parameters:
O - Object type

public class TextWriter<O extends DatabaseObject>
extends Object

Class to write a result to human-readable text output

Author:
Erich Schubert

Field Summary
static String FILE_EXTENSION
          Extension for txt-files.
private static Logging logger
          Logger
private  Normalization<O> normalization
          Normalization to use.
static HandlerList<TextWriterWriterInterface<?>> writers
          Hash map for supported classes in writer.
 
Constructor Summary
TextWriter()
           
 
Method Summary
private  String filenameFromLabel(String label)
          Derive a file name from the cluster label.
 Normalization<O> getNormalization()
          Getter for normalization
 void output(Database<O> db, Result r, StreamFactory streamOpener)
          Stream output.
private  void printObject(TextWriterStream out, O obj, List<Pair<String,Object>> anns)
           
protected  void printSettings(Database<O> db, TextWriterStream out, List<AttributeSettings> settings)
          Writes a header providing information concerning the underlying database and the specified parameter-settings.
 void setNormalization(Normalization<O> normalization)
          Setter for normalization
private  void writeGroupResult(Database<O> db, StreamFactory streamOpener, DatabaseObjectGroup group, List<AnnotationResult<?>> ra, List<OrderingResult> ro, NamingScheme naming, List<AttributeSettings> settings)
           
private  void writeIterableResult(Database<O> db, StreamFactory streamOpener, IterableResult<?> ri, List<MetadataResult> rm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Logging logger
Logger


FILE_EXTENSION

public static final String FILE_EXTENSION
Extension for txt-files.

See Also:
Constant Field Values

writers

public static final HandlerList<TextWriterWriterInterface<?>> writers
Hash map for supported classes in writer.


normalization

private Normalization<O extends DatabaseObject> normalization
Normalization to use.

Constructor Detail

TextWriter

public TextWriter()
Method Detail

printSettings

protected void printSettings(Database<O> db,
                             TextWriterStream out,
                             List<AttributeSettings> settings)
Writes a header providing information concerning the underlying database and the specified parameter-settings.

Parameters:
db - to retrieve meta information from
out - the print stream where to write
settings - the settings to be written into the header

output

public void output(Database<O> db,
                   Result r,
                   StreamFactory streamOpener)
            throws UnableToComplyException,
                   IOException
Stream output.

Parameters:
db - Database object
r - Result class
streamOpener - output stream manager
Throws:
UnableToComplyException
IOException

printObject

private void printObject(TextWriterStream out,
                         O obj,
                         List<Pair<String,Object>> anns)
                  throws UnableToComplyException,
                         IOException
Throws:
UnableToComplyException
IOException

writeGroupResult

private void writeGroupResult(Database<O> db,
                              StreamFactory streamOpener,
                              DatabaseObjectGroup group,
                              List<AnnotationResult<?>> ra,
                              List<OrderingResult> ro,
                              NamingScheme naming,
                              List<AttributeSettings> settings)
                       throws FileNotFoundException,
                              UnableToComplyException,
                              IOException
Throws:
FileNotFoundException
UnableToComplyException
IOException

writeIterableResult

private void writeIterableResult(Database<O> db,
                                 StreamFactory streamOpener,
                                 IterableResult<?> ri,
                                 List<MetadataResult> rm)
                          throws UnableToComplyException,
                                 IOException
Throws:
UnableToComplyException
IOException

setNormalization

public void setNormalization(Normalization<O> normalization)
Setter for normalization

Parameters:
normalization - new normalization object

getNormalization

public Normalization<O> getNormalization()
Getter for normalization

Returns:
normalization object

filenameFromLabel

private String filenameFromLabel(String label)
Derive a file name from the cluster label.

Parameters:
label - cluster label
Returns:
cleaned label suitable for file names.

Release 0.2.1 (2009-07-13_1605)