edu.berkeley.guir.ptk.notification
Class ThresholdNotificationSetter

java.lang.Object
  extended byedu.berkeley.guir.ptk.PTK
      extended byedu.berkeley.guir.ptk.notification.NotificationSetter
          extended byedu.berkeley.guir.ptk.notification.ThresholdNotificationSetter

public class ThresholdNotificationSetter
extends NotificationSetter

Used to specify the notification levels that should be set when event data falls within a certain range or threshold. You must set the data fields of this class specifying what range of data values correspond to each notification level. If you do not set some of the data fields, the notification will simply not be set for those notification levels. You do need to worry about setting metadata or data ids for any data fields in this class - they are not checked. Only the data values are checked: data value, min, max, and step.

Takes either five or six parameters (parameter (1) is optional):

  1. a String data ID (or an array of Strings for multiple data IDs), which should match the data ID(s) of the event Data the notification setter should examine (if this parameter is excluded, the setter will examine every Data in events;
  2. a Data object corresponding to the ignore notification level (i.e., any event that changes by this amount will be set to ignore level);
  3. a Data object corresponding to the change blind notification level;
  4. a Data object corresponding to the make aware notification level;
  5. a Data object corresponding to the interrupt notification level;
  6. a Data object corresponding to the demand action notification level.

Author:
tmatthew

Field Summary
 DataRange threshold_changeblind
           
 DataRange threshold_demandaction
           
 DataRange threshold_ignore
          Indicate the threshold number ranges needed for each notification level.
 DataRange threshold_interrupt
           
 DataRange threshold_makeaware
           
 
Fields inherited from class edu.berkeley.guir.ptk.notification.NotificationSetter
data_id, translate
 
Fields inherited from class edu.berkeley.guir.ptk.PTK
debug, MAX_DEBUG, MED_DEBUG, MIN_DEBUG, NO_DEBUG
 
Constructor Summary
ThresholdNotificationSetter()
          Default constructor.
ThresholdNotificationSetter(DataRange ignore, DataRange changeblind, DataRange makeaware, DataRange interrupt, DataRange demandaction)
          Same as the previous two, except no data IDs.
ThresholdNotificationSetter(java.lang.String[] data_id_to_check, DataRange ignore, DataRange changeblind, DataRange makeaware, DataRange interrupt, DataRange demandaction)
          Same as previous constructor, except for the first parameter.
ThresholdNotificationSetter(java.lang.String data_id_to_check, DataRange ignore, DataRange changeblind, DataRange makeaware, DataRange interrupt, DataRange demandaction)
          Constructor.
 
Method Summary
 int set(Event e, History h)
          Assumes data passed with event will have some quantifiable range that can be put in a certain order (i.e., numbers, alphabetized strings).
 
Methods inherited from class edu.berkeley.guir.ptk.notification.NotificationSetter
addMetadataIWant, canISetNotification, getAllMetadata, getEventData, getEventDataAsDouble, getFirstMetadata
 
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

threshold_ignore

public DataRange threshold_ignore
Indicate the threshold number ranges needed for each notification level. For example, setting threshold_ignore to a range from 0 to 20 would mean that if the new event is 0 and 20 (inclusive) than the notification level should be set to "ignore."

The setter will simply not set the notification level to any level for which a change value is not specified.


threshold_changeblind

public DataRange threshold_changeblind

threshold_makeaware

public DataRange threshold_makeaware

threshold_interrupt

public DataRange threshold_interrupt

threshold_demandaction

public DataRange threshold_demandaction
Constructor Detail

ThresholdNotificationSetter

public ThresholdNotificationSetter()
Default constructor. Sets all data fields to null except translate, which is set to a new Translate object.


ThresholdNotificationSetter

public ThresholdNotificationSetter(java.lang.String data_id_to_check,
                                   DataRange ignore,
                                   DataRange changeblind,
                                   DataRange makeaware,
                                   DataRange interrupt,
                                   DataRange demandaction)
Constructor.

Parameters:
data_id_to_check - The data ID in the input event that this notification setter will check when setting the notification level. For example, if the setter is sets the notification level depending on the volume of an audio input, then this would be set to PTKConstants.VOLUME_ID.
ignore - This is a DataRange object that will be compared to the input event. If the input event is a number that falls in the range of this DataRange, then the notification level will be set to ignore.
changeblind - This is a DataRange object that will be compared to the input event. If the input event is a number that falls in the range of this DataRange, then the notification level will be set to changeblind.
makeaware - This is a DataRange object that will be compared to the input event. If the input event is a number that falls in the range of this DataRange, then the notification level will be set to makeaware.
interrupt - This is a DataRange object that will be compared to the input event. If the input event is a number that falls in the range of this DataRange, then the notification level will be set to interrupt.
demandaction - This is a DataRange object that will be compared to the input event. If the input event is a number that falls in the range of this DataRange, then the notification level will be set to demandchange.

ThresholdNotificationSetter

public ThresholdNotificationSetter(java.lang.String[] data_id_to_check,
                                   DataRange ignore,
                                   DataRange changeblind,
                                   DataRange makeaware,
                                   DataRange interrupt,
                                   DataRange demandaction)
Same as previous constructor, except for the first parameter.


ThresholdNotificationSetter

public ThresholdNotificationSetter(DataRange ignore,
                                   DataRange changeblind,
                                   DataRange makeaware,
                                   DataRange interrupt,
                                   DataRange demandaction)
Same as the previous two, except no data IDs. This means that the notification setters will look at ALL Data objects in events that arrive when setting the notification level.

Method Detail

set

public int set(Event e,
               History h)
Assumes data passed with event will have some quantifiable range that can be put in a certain order (i.e., numbers, alphabetized strings). The getEventDataAsDouble method is used to convert the event data to a double, which is used as the quantifiable range. This method uses the Translate object passed to this NotificationSetter to perform the translation of the event data to a double. The developer can pass a custom Translate object in to perform this translation.

Specified by:
set in class NotificationSetter
Parameters:
e - The event that may have its notification set.
h - The history of events that have been passed to this application.
Returns:
The notification level to which it set the event.