emolib.formatter
Class AffectiveFormatter

java.lang.Object
  extended by emolib.util.proc.TextDataProcessor
      extended by emolib.formatter.AffectiveFormatter
All Implemented Interfaces:
Configurable, DataProcessor
Direct Known Subclasses:
XMLFormatter

public abstract class AffectiveFormatter
extends TextDataProcessor

The AffectiveFormatter abstract class defines the general structure to perform the formatting of the results.

This module should format the results obtained from the processing chain and present them accordingly. For this purpose, it must always be plugged at the end of the processing pipeline thus being the last text data processor of the chain.

Due to the position where this module is located and the function it has been designed for, it is commonly referred to as the OUTPUTTER of the pipeline, therefore it implements the "outputData" method.

Author:
Alexandre Trilla (atrilla@salle.url.edu)

Constructor Summary
AffectiveFormatter()
          Main constructor of the AffectiveFormatter.
 
Method Summary
abstract  void applyFormatting(TextData inputTextDataObject)
          Method to perform the formatting process.
 Data getData()
          Obtains the TextData from the previous module, processes it and makes it available to the rest of the text processing chain.
 void initialize()
          Method to initialize the AffectiveFormatter.
 void newProperties(PropertySheet ps)
          This method is called when this configurable component has new data.
abstract  void outputData()
          Method to produce the results obtained from the text processing pipeline into a file.
abstract  void outputData(java.io.File file)
          Method to produce the results obtained from the text processing pipeline into a determined file.
 void register(java.lang.String name, Registry registry)
          Register my properties.
 
Methods inherited from class emolib.util.proc.TextDataProcessor
flush, getName, getPredecessor, setPredecessor, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AffectiveFormatter

public AffectiveFormatter()
Main constructor of the AffectiveFormatter.

Method Detail

register

public void register(java.lang.String name,
                     Registry registry)
              throws PropertyException
Description copied from interface: Configurable
Register my properties. This method is called once early in the time of the component, shortly after the component is constructed. This component should register any configuration properties that it needs to register. If this configurable extends another configurable, super.register should also be called

Specified by:
register in interface Configurable
Overrides:
register in class TextDataProcessor
Parameters:
name - the name of the component
registry - the registry for this component
Throws:
PropertyException

newProperties

public void newProperties(PropertySheet ps)
                   throws PropertyException
Description copied from interface: Configurable
This method is called when this configurable component has new data. The component should first validate the data. If it is bad the component should return false. If the data is good, the component should record the the data internally and return true.

Specified by:
newProperties in interface Configurable
Overrides:
newProperties in class TextDataProcessor
Parameters:
ps - a property sheet holding the new data
Throws:
PropertyException - if there is a problem with the properties.

getData

public Data getData()
             throws DataProcessingException
Obtains the TextData from the previous module, processes it and makes it available to the rest of the text processing chain.

Specified by:
getData in interface DataProcessor
Specified by:
getData in class TextDataProcessor
Returns:
The next available Data object, returns null if no Data object is available.
Throws:
DataProcessingException - If there is a processing error.

initialize

public void initialize()
Method to initialize the AffectiveFormatter.

Specified by:
initialize in interface DataProcessor
Overrides:
initialize in class TextDataProcessor

applyFormatting

public abstract void applyFormatting(TextData inputTextDataObject)
Method to perform the formatting process. This method should take record of all the results that flow through it.

Parameters:
inputTextDataObject - The TextData object to process.

outputData

public abstract void outputData()
Method to produce the results obtained from the text processing pipeline into a file. This method labels the AffectiveFormatter module as an OUTPUTTER. This implementation is the original one. The method that follows should substitute it for wrapping design.


outputData

public abstract void outputData(java.io.File file)
Method to produce the results obtained from the text processing pipeline into a determined file. This method labels the AffectiveFormatter module as an OUTPUTTER.

Parameters:
file - File The determined file to output the results. This is normally a temp file.