edu.berkeley.guir.ptk.abstraction
Class Abstractor

java.lang.Object
  extended byedu.berkeley.guir.ptk.PTK
      extended byedu.berkeley.guir.ptk.abstraction.Abstractor
Direct Known Subclasses:
MotionAbstractor, PeopleCountAbstractor, TelephoneAbstractor, VoiceAbstractor

public abstract class Abstractor
extends PTK

Abstractor is the based class that defines the functionality for abstraction. The doAbstract method determines how an event's data will be abstracted (i.e., modified to answer a question notification setters and/or an output care to ask about the data. This is the method you should implement when you extend this class.

See the package comments for more information on how to write an Abstractor, customize an existing one, and more.

Author:
tmatthew Created: Mar 2, 2003

Field Summary
 java.lang.String[] data_ids_I_want
          An array of data IDs (as Strings) that specify which data withint an Event this Abstractor can to abstract.
 boolean replace_data
          Flag that can be used to specify if an abstractor should remove the original data from an event and replace it with the new data; set to false by default, which means that the original data in an event will be left as is and abstracted data will be added to the event.
 
Fields inherited from class edu.berkeley.guir.ptk.PTK
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG
 
Constructor Summary
Abstractor()
           
 
Method Summary
 void addMetadataIWant(Metadata mds)
          Performs a deep copy of the MetadataItems in the array passed in to the metadata_I_want data field.
 boolean canIAbstract(Event e)
          Compares the given metadata items to this Abstractor's metadata.
abstract  boolean doAbstract(Event e, History h)
          Performs the abstraction of the event e as specified by the class that implements this interface.
 Metadata[] getAllMetadata()
          Returns all Metadata objects that indicate all input events the abstractor can abstract (used for connections to multiple inputs).
 Metadata getFirstMetadata()
          Returns only the first Metadata object; for abstractors that connect to only a single input, the first will be the ONLY Metadata object.
 
Methods inherited from class edu.berkeley.guir.ptk.PTK
getMAX, getMED, getMIN, getNO, printDebug, printDebug, printError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data_ids_I_want

public java.lang.String[] data_ids_I_want
An array of data IDs (as Strings) that specify which data withint an Event this Abstractor can to abstract. It will use this data field to check against the data IDs in the input Event. This field is by default null, but developers may find use for further filtering of input events.


replace_data

public boolean replace_data
Flag that can be used to specify if an abstractor should remove the original data from an event and replace it with the new data; set to false by default, which means that the original data in an event will be left as is and abstracted data will be added to the event. In order to use this flag, you must include a line in your abstractor: if (replace_data) e.removeAllData();. Library abstractors already include this line.

Constructor Detail

Abstractor

public Abstractor()
Method Detail

doAbstract

public abstract boolean doAbstract(Event e,
                                   History h)
Performs the abstraction of the event e as specified by the class that implements this interface. Returns true if the abstraction was successful and false otherwise.

Parameters:
e -
h -
Returns:
boolean

canIAbstract

public boolean canIAbstract(Event e)
Compares the given metadata items to this Abstractor's metadata. If the this.metadata is included in the given metadata, then it returns true. This indicates that this Abstractor can abstract the event with the given metadata. Also compares data ids, though the default for Abstractors is to have no data ids set.


addMetadataIWant

public void addMetadataIWant(Metadata mds)
Performs a deep copy of the MetadataItems in the array passed in to the metadata_I_want data field. Use this method instead of "=" so that multiple objects are not sharing the same array of MetadatItems.


getFirstMetadata

public Metadata getFirstMetadata()
Returns only the first Metadata object; for abstractors that connect to only a single input, the first will be the ONLY Metadata object.

Returns:

getAllMetadata

public Metadata[] getAllMetadata()
Returns all Metadata objects that indicate all input events the abstractor can abstract (used for connections to multiple inputs).

Returns: