edu.washington.cs.knowitall.extractor.mapper
Class Mapper<T>

java.lang.Object
  extended by edu.washington.cs.knowitall.extractor.mapper.Mapper<T>
Type Parameters:
T -
Direct Known Subclasses:
FilterMapper, IndependentMapper, MapperList, MaxMapper, MergeOverlappingMapper

public abstract class Mapper<T>
extends java.lang.Object

A class for taking a stream of T objects and modifying it somehow (e.g. by filtering or modifying some objects). A Mapper object has two states: enabled and disabled. If the Mapper is disabled, it will return the stream of objects unmodified. Subclasses extending Mapper should implement the doMap(Iterable objects) method.

Author:
afader

Constructor Summary
Mapper()
           
 
Method Summary
 void disable()
          Disables this mapper.
protected abstract  java.lang.Iterable<T> doMap(java.lang.Iterable<T> objects)
           
 void enable()
          Enables this mapper.
 boolean isEnabled()
           
 java.lang.Iterable<T> map(java.lang.Iterable<T> objects)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mapper

public Mapper()
Method Detail

doMap

protected abstract java.lang.Iterable<T> doMap(java.lang.Iterable<T> objects)
Parameters:
objects - a stream of objects
Returns:
a modified stream of objects

map

public java.lang.Iterable<T> map(java.lang.Iterable<T> objects)
Parameters:
objects - a stream of objects
Returns:
a modified stream of objects if the mapper is enabled, the unmodified input stream otherwise.

isEnabled

public boolean isEnabled()
Returns:
true if this mapper is enabled.

disable

public void disable()
Disables this mapper.


enable

public void enable()
Enables this mapper.