de.fu_berlin.ties.context.sensor
Class BaseSensor

java.lang.Object
  extended by de.fu_berlin.ties.context.sensor.BaseSensor
All Implemented Interfaces:
Sensor
Direct Known Subclasses:
ListSensor

public abstract class BaseSensor
extends Object
implements Sensor

Abstract implementation of the Sensor interface that stores a configuration and provides a factory method to initialize a set of sensors.

Version:
$Revision: 1.7 $, $Date: 2006/10/21 16:04:06 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
BaseSensor(TiesConfiguration conf)
          Creates a new instance.
 
Method Summary
static Sensor[] createSensors(String[] classNames, TiesConfiguration conf)
          Factory method that initializes an array of sensors.
 TiesConfiguration getConfig()
          Returns the configuration used by this instance.
 void initDocument(File filename, TokenizerFactory tFactory)
          Called when starting to process a new document. The default implementation does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.fu_berlin.ties.context.sensor.Sensor
lookup
 

Constructor Detail

BaseSensor

public BaseSensor(TiesConfiguration conf)
Creates a new instance.

Parameters:
conf - the configuration to use
Method Detail

createSensors

public static Sensor[] createSensors(String[] classNames,
                                     TiesConfiguration conf)
                              throws ProcessingException
Factory method that initializes an array of sensors.

Parameters:
classNames - array of fully specified names of classes implementing the Sensor interface; each of them must provide a constructor that accepts a TiesConfiguration as single argument
conf - used to configure the sensors
Returns:
an array of newly created sensors
Throws:
ProcessingException - if an error occurred while creating the classifier

getConfig

public TiesConfiguration getConfig()
Returns the configuration used by this instance.

Returns:
the configuration

initDocument

public void initDocument(File filename,
                         TokenizerFactory tFactory)
                  throws ProcessingException,
                         IOException
Called when starting to process a new document. The default implementation does nothing.

Specified by:
initDocument in interface Sensor
Parameters:
filename - the name of the file
tFactory - a factory that can be used for creating tokenizers, if required
Throws:
ProcessingException - if an error occurs while starting to process the document
IOException - if an I/O error occurs


Copyright © 2003-2007 Christian Siefkes. All Rights Reserved.