com.isti.quakewatch.util
Class QWAlarmProperties

java.lang.Object
  extended by com.isti.quakewatch.util.QWAlarmProperties

public class QWAlarmProperties
extends java.lang.Object

Class QWAlarmProperties manages the QuakeWatch client alarm property items.


Field Summary
protected  java.lang.Object alarmConfigSyncObject
          Thread-synchronization object for alarm configuration.
protected  CfgPropItem alarmDepthPropObs
          Obsolete: Maximum depth for alarm ("alarmDepth").
 CfgPropItem alarmMagnitudeProp
          Minimum magnitude for alarm.
static int ALL_ALARMS
          The bit flag for all alarm.
static int AUDIBLE_ALARM
          The bit flag for the audible alarm.
 CfgPropItem maxAlarmDepthProp
          Maximum depth for alarm (0.0 = no maximum).
 CfgPropItem maxAlarmEventHoursProp
          Maximum alarm event age in hours (0=infinite).
 CfgPropItem minAlarmAmplitudeProp
          Minimum amplitude for alarm (not in alarm group).
 CfgPropItem minAlarmDepthProp
          Minimum depth for alarm.
static int NO_ALARMS
          The bit flag for no alarm.
 CfgPropItem regionsAlarmProp
          Regions for alarm.
 CfgPropItem verifiedEventsAlarmFlagProp
          Verified (reviewed) events trigger alarm.
static int VISUAL_ALARM
          The bit flag for the visual alarm.
 
Constructor Summary
QWAlarmProperties()
          Creates an object for the QuakeWatch client alarm configuration.
QWAlarmProperties(CfgProperties settingsProps, java.lang.Object groupSelObj)
          Creates an object for the QuakeWatch client alarm configuration.
 
Method Summary
 void addAlarmPropertyItems(CfgProperties settingsProps, java.lang.Object groupSelObj)
          Adds alarm-property items to the given configuration-properties object.
protected  void addAlarmReason(java.lang.StringBuffer alarmReason, java.lang.String msg)
          Adds the message to the alarm reason.
protected  int checkAlarm(double eventMagAmpVal, java.util.Date eventTime, boolean eventVerifedFlag, double eventDepth, double minAlarmDepth, double maxAlarmDepth, double minAlarmMagAmp, long maxAlarmAgeMillis, boolean verifiedEventsAlarmFlag, boolean audibleAlarmFlag, boolean visualAlarmFlag, java.lang.StringBuffer alarmReason, boolean amplitudeFlag)
          Checks the alarm settings.
 int checkAlarmEvent(QWEventMsgRecord recObj)
          Checks if an event should start alarm.
 int checkAlarmEvent(QWEventMsgRecord recObj, IstiRegion[] regionsArr)
          Checks if an event should start alarm.
 int checkAlarmEvent(QWEventMsgRecord recObj, IstiRegion[] regionsArr, java.lang.StringBuffer alarmReason)
          Checks if an event should start alarm.
protected  int checkRegion(double eventMagVal, java.util.Date eventTime, boolean eventVerifedFlag, double eventDepth, java.lang.StringBuffer alarmReason, IstiRegion regionObj)
          Checks if an event should start alarm.
 CfgPropItem getMinAlarmAmplitudeProp()
          Returns the "Minimum amplitude for alarm" configuration property item object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_ALARMS

public static final int NO_ALARMS
The bit flag for no alarm.

See Also:
Constant Field Values

VISUAL_ALARM

public static final int VISUAL_ALARM
The bit flag for the visual alarm.

See Also:
Constant Field Values

AUDIBLE_ALARM

public static final int AUDIBLE_ALARM
The bit flag for the audible alarm.

See Also:
Constant Field Values

ALL_ALARMS

public static final int ALL_ALARMS
The bit flag for all alarm.

See Also:
Constant Field Values

alarmConfigSyncObject

protected final java.lang.Object alarmConfigSyncObject
Thread-synchronization object for alarm configuration.


alarmMagnitudeProp

public final CfgPropItem alarmMagnitudeProp
Minimum magnitude for alarm.


minAlarmDepthProp

public final CfgPropItem minAlarmDepthProp
Minimum depth for alarm.


maxAlarmDepthProp

public final CfgPropItem maxAlarmDepthProp
Maximum depth for alarm (0.0 = no maximum).


maxAlarmEventHoursProp

public final CfgPropItem maxAlarmEventHoursProp
Maximum alarm event age in hours (0=infinite).


verifiedEventsAlarmFlagProp

public final CfgPropItem verifiedEventsAlarmFlagProp
Verified (reviewed) events trigger alarm.


regionsAlarmProp

public final CfgPropItem regionsAlarmProp
Regions for alarm.


minAlarmAmplitudeProp

public final CfgPropItem minAlarmAmplitudeProp
Minimum amplitude for alarm (not in alarm group).


alarmDepthPropObs

protected final CfgPropItem alarmDepthPropObs
Obsolete: Maximum depth for alarm ("alarmDepth").

Constructor Detail

QWAlarmProperties

public QWAlarmProperties(CfgProperties settingsProps,
                         java.lang.Object groupSelObj)
Creates an object for the QuakeWatch client alarm configuration. Alarm configuration property items are added to the given configuration properties object (if given).

Parameters:
settingsProps - the configuration-properties object to use, or null for none.
groupSelObj - the configuration-group-selection object to use, or null for none.

QWAlarmProperties

public QWAlarmProperties()
Creates an object for the QuakeWatch client alarm configuration.

Method Detail

addAlarmPropertyItems

public final void addAlarmPropertyItems(CfgProperties settingsProps,
                                        java.lang.Object groupSelObj)
Adds alarm-property items to the given configuration-properties object.

Parameters:
settingsProps - the configuration-properties object to use.
groupSelObj - the configuration-group-selection object to use, or null for none.

getMinAlarmAmplitudeProp

public CfgPropItem getMinAlarmAmplitudeProp()
Returns the "Minimum amplitude for alarm" configuration property item object. This item object is created and held by this alarm-properties object but is not added to the configuration properties object or the alarm group. Client programs that use this configuration property item will fetch it via this method, add it to the configuration properties and setup its group-select object.

Returns:
The "Minimum amplitude for alarm" configuration property item object.

checkAlarmEvent

public int checkAlarmEvent(QWEventMsgRecord recObj)
Checks if an event should start alarm.

Parameters:
recObj - the event message record.
Returns:
the bit flag for the alarm.

checkAlarmEvent

public int checkAlarmEvent(QWEventMsgRecord recObj,
                           IstiRegion[] regionsArr)
Checks if an event should start alarm.

Parameters:
recObj - the event message record.
regionsArr - the regions for the alarm or null if none.
Returns:
the bit flag for the alarm.

checkAlarmEvent

public int checkAlarmEvent(QWEventMsgRecord recObj,
                           IstiRegion[] regionsArr,
                           java.lang.StringBuffer alarmReason)
Checks if an event should start alarm.

Parameters:
recObj - the event message record.
regionsArr - the regions for the alarm or null if none.
alarmReason - if supplied the reason the alarm should or should not start be started.
Returns:
the bit flag for the alarm.

addAlarmReason

protected void addAlarmReason(java.lang.StringBuffer alarmReason,
                              java.lang.String msg)
Adds the message to the alarm reason.

Parameters:
alarmReason - the alarm reason.
msg - the message.

checkAlarm

protected int checkAlarm(double eventMagAmpVal,
                         java.util.Date eventTime,
                         boolean eventVerifedFlag,
                         double eventDepth,
                         double minAlarmDepth,
                         double maxAlarmDepth,
                         double minAlarmMagAmp,
                         long maxAlarmAgeMillis,
                         boolean verifiedEventsAlarmFlag,
                         boolean audibleAlarmFlag,
                         boolean visualAlarmFlag,
                         java.lang.StringBuffer alarmReason,
                         boolean amplitudeFlag)
Checks the alarm settings.

Parameters:
eventMagAmpVal - the event magnitude or amplitude.
eventTime - the event time.
eventVerifedFlag - the event verified flag.
eventDepth - the event depth.
minAlarmDepth - the minimum alarm depth.
maxAlarmDepth - the maximum alarm depth.
minAlarmMagAmp - the alarm magnitude or amplitude.
maxAlarmAgeMillis - the maximum alarm age.
verifiedEventsAlarmFlag - the verified events alarm flag.
audibleAlarmFlag - true for audible alarm.
visualAlarmFlag - true for visual alarm.
alarmReason - if supplied the reason the alarm should or should not start be started.
amplitudeFlag - true if amplitude event, false if earthquake magnitude event.
Returns:
the bit flag for the alarm.

checkRegion

protected int checkRegion(double eventMagVal,
                          java.util.Date eventTime,
                          boolean eventVerifedFlag,
                          double eventDepth,
                          java.lang.StringBuffer alarmReason,
                          IstiRegion regionObj)
Checks if an event should start alarm.

Parameters:
eventMagVal - the event magnitude.
eventTime - the event time.
eventVerifedFlag - the event verified flag.
eventDepth - the event depth.
alarmReason - if supplied the reason the alarm should or should not start be started.
regionObj - the region object.
Returns:
the bit flag for the alarm.