twaver.alarm
Class AlarmStateStatistics

java.lang.Object
  extended by twaver.alarm.AlarmStateStatistics

public class AlarmStateStatistics
extends java.lang.Object

The AlarmStateStatistics class is designed to calculate alarm state of elements in connected data box.


Constructor Summary
AlarmStateStatistics()
          Creates a AlarmStateStatistics instance with a default data box created inside the initialization.
AlarmStateStatistics(ElementBox box)
          Creates a a AlarmStateStatistics instance with a given data box object.
AlarmStateStatistics(ElementBox box, java.util.List<AlarmSeverity> alarmSeverities)
          Creates a a AlarmStateStatistics instance with a given data box object.
 
Method Summary
 void addPropertyChangeListener(IListener<PropertyChangeEvent> listener)
           
protected  void fireAlarmStateChange()
          Fire alarm state change event.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
 ElementBox geElementBox()
          Gets the connected data box.
 int getAcknowledgedAlarmCount()
          Gets the acknowledged alarm count of elements in connected data box.
 int getAcknowledgedAlarmCount(AlarmSeverity severity)
          Get acknowledged alarm count for specified alarm severity.
 int getNewAlarmCount()
          Gets the new alarm count of elements in connected data box.
 int getNewAlarmCount(AlarmSeverity severity)
          Get new alarm count for specified alarm severity.
 IDispatcher<PropertyChangeEvent> getPropertyChangeDispatcher()
           
 java.util.List<AlarmSeverity> getSeverityList()
          Gets a list contains all alarm severities that are interested.
 int getTotalAlarmCount()
          Gets the total alarm count of elements in connected data box, including new and acknowledged alarm.
 int getTotalAlarmCount(AlarmSeverity severity)
          Get alarm total count for specified alarm severity.
 IFilter<Element> getVisibleFilter()
          Gets the visible filter for this alarm statistic.
 boolean isVisible(Element element)
          Checks whether the given element is needed to be calculated for this alarm statistic.
 void removePropertyChangeListener(IListener<PropertyChangeEvent> listener)
           
 void reset()
          Calls this method to recalculate all alarm count of elements in data box.
 void seElementBox(ElementBox box)
          Sets a new data box for this alarm state statistic.
 void setVisibleFilter(IFilter<Element> visibleFilter)
          Sets a new visible filter for this alarm statistic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlarmStateStatistics

public AlarmStateStatistics()
Creates a AlarmStateStatistics instance with a default data box created inside the initialization.


AlarmStateStatistics

public AlarmStateStatistics(ElementBox box)
Creates a a AlarmStateStatistics instance with a given data box object.

Parameters:
box - the connected data box object.

AlarmStateStatistics

public AlarmStateStatistics(ElementBox box,
                            java.util.List<AlarmSeverity> alarmSeverities)
Creates a a AlarmStateStatistics instance with a given data box object.

Parameters:
box - the connected data box object.
alarmSeverities - a list contains alarm severities that need to be calculated.
Method Detail

getPropertyChangeDispatcher

public IDispatcher<PropertyChangeEvent> getPropertyChangeDispatcher()

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)

addPropertyChangeListener

public void addPropertyChangeListener(IListener<PropertyChangeEvent> listener)

removePropertyChangeListener

public void removePropertyChangeListener(IListener<PropertyChangeEvent> listener)

geElementBox

public ElementBox geElementBox()
Gets the connected data box.

Returns:
the connected data box.

seElementBox

public void seElementBox(ElementBox box)
Sets a new data box for this alarm state statistic.

Parameters:
box - a new data box to be calculated.

fireAlarmStateChange

protected void fireAlarmStateChange()
Fire alarm state change event.


getNewAlarmCount

public int getNewAlarmCount()
Gets the new alarm count of elements in connected data box.

Returns:
the new alarm count of elements in connected data box.

getTotalAlarmCount

public int getTotalAlarmCount()
Gets the total alarm count of elements in connected data box, including new and acknowledged alarm.

Returns:
the total alarm count of elements in connected data box.

getAcknowledgedAlarmCount

public int getAcknowledgedAlarmCount()
Gets the acknowledged alarm count of elements in connected data box.

Returns:
the acknowledged alarm count of elements in connected data box.

getTotalAlarmCount

public int getTotalAlarmCount(AlarmSeverity severity)
Get alarm total count for specified alarm severity.

Parameters:
severity - AlarmSeverity an alarm severity to be calculate
Returns:
int the calculated total count for the specified alarm severity

getNewAlarmCount

public int getNewAlarmCount(AlarmSeverity severity)
Get new alarm count for specified alarm severity.

Parameters:
severity - AlarmSeverity alarm severity to be check
Returns:
int new alarm count for specified alarm severity.
See Also:
getAcknowledgedAlarmCount()

getAcknowledgedAlarmCount

public int getAcknowledgedAlarmCount(AlarmSeverity severity)
Get acknowledged alarm count for specified alarm severity.

Parameters:
severity - AlarmSeverity alarm severity to be check
Returns:
int acknowledged alarm count for specified alarm severity.
See Also:
getNewAlarmCount()

reset

public void reset()
Calls this method to recalculate all alarm count of elements in data box.


getVisibleFilter

public IFilter<Element> getVisibleFilter()
Gets the visible filter for this alarm statistic. by default, all elements in data box will be calculated, by the visible filter you can filter out some elements.

Returns:
the visible filter for this alarm statistic.

setVisibleFilter

public void setVisibleFilter(IFilter<Element> visibleFilter)
Sets a new visible filter for this alarm statistic. by default, all elements in data box will be calculated, by the visible filter you can filter out some elements.

Parameters:
visibleFilter - a new visible filter.

isVisible

public boolean isVisible(Element element)
Checks whether the given element is needed to be calculated for this alarm statistic.

Parameters:
element - the element to be checked.
Returns:
True if the given element is needed to be calculated, false otherwise.

getSeverityList

public java.util.List<AlarmSeverity> getSeverityList()
Gets a list contains all alarm severities that are interested.

Returns:
a list contains all alarm severities that are interested.