edu.berkeley.guir.ptk.notification
Class DegreeChangeNotificationSetter

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

public class DegreeChangeNotificationSetter
extends NotificationSetter

Determines if a given event has changed by an amount specified by any of the notification level Data parameters. Compares the new event to the last event. Sets the notification level based on which Data parameter indicates the amount of change.

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 Created: Mar 2, 2003

Field Summary
 DataRange change_changeblind
           
 DataRange change_demandaction
           
 DataRange change_ignore
          These data fields indicate the degree of change needed for each notification level.
 DataRange change_interrupt
           
 DataRange change_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
DegreeChangeNotificationSetter()
          Default constructor.
DegreeChangeNotificationSetter(DataRange ignore, DataRange changeblind, DataRange makeaware, DataRange interrupt, DataRange demandaction)
          Same as the previous two, except no data IDs.
DegreeChangeNotificationSetter(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.
DegreeChangeNotificationSetter(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 difference from one event to another is defined (i.e., in an alphabetized string, 10 could be defined to be the difference between c and m).
 
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

change_ignore

public DataRange change_ignore
These data fields indicate the degree of change needed for each notification level. For example, setting change_ignore to 2 would mean that if the new event is within 2 (inclusive) of the last event 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.


change_changeblind

public DataRange change_changeblind

change_makeaware

public DataRange change_makeaware

change_interrupt

public DataRange change_interrupt

change_demandaction

public DataRange change_demandaction
Constructor Detail

DegreeChangeNotificationSetter

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


DegreeChangeNotificationSetter

public DegreeChangeNotificationSetter(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. The setter subtracts the input event to the previous input event with from the same input source and if the result 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. The setter subtracts the input event to the previous input event with from the same input source and if the result 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. The setter subtracts the input event to the previous input event with from the same input source and if the result 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. The setter subtracts the input event to the previous input event with from the same input source and if the result 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. The setter subtracts the input event to the previous input event with from the same input source and if the result is a number that falls in the range of this DataRange, then the notification level will be set to demandchange.

DegreeChangeNotificationSetter

public DegreeChangeNotificationSetter(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.


DegreeChangeNotificationSetter

public DegreeChangeNotificationSetter(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 difference from one event to another is defined (i.e., in an alphabetized string, 10 could be defined to be the difference between c and m). The getEventDataAsDouble method is used to convert the event data to a double. 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.

The application developer specifies what amount of change is necessary for different notification levels by setting the data fields of this NotificationSetter.

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.