twaver.alarm
Class AlarmBox

java.lang.Object
  extended by twaver.model.HashList<T>
      extended by twaver.model.HashCollection<T>
          extended by twaver.model.DataBox<Alarm>
              extended by twaver.alarm.AlarmBox
All Implemented Interfaces:
java.lang.Iterable<Alarm>, java.util.Collection<Alarm>, IDataBox<Alarm>, IHashCollection<Alarm>, IHashList<Alarm>, IHandler<ListEvent<Alarm>>, IFilter<Alarm>

public class AlarmBox
extends DataBox<Alarm>

告警容器,用于管理告警对象的数据容器


Field Summary
 
Fields inherited from class twaver.model.DataBox
roots
 
Fields inherited from class twaver.model.HashList
dataList, dataMap
 
Constructor Summary
AlarmBox(ElementBox elementBox)
          Constructor of AlarmBox.
 
Method Summary
 IAlarmElementMapping getAlarmElementMapping()
          Get the alarm-elemen mapping object.
 java.util.List<Alarm> getCorrespondingAlarms(Element element)
          Get the corresponding alarms of the given element, that is, all alarms occured on this element object.
 java.util.List<Element> getCorrespondingElements(Alarm alarm)
          Get all corresponding elements by given the alarm object.
 ElementBox getElementBox()
          Get the element box this alarm box connect to.
 boolean isRemoveAlarmWhenAlarmIsCleared()
          Indicates whether the alarm object will be removed from alarm box when this alarm severity/status is changed to "cleared".
 boolean isRemoveAlarmWhenElementIsRemoved()
          The flag value indicates that whether all alarms occured on an element need to be removed as well when the element is removed from the element box.
protected  void onAdd(int index, Alarm data)
          添加元素
 void removeByElement(Element element)
          Remove all corresponding alarms of given element object.
 void setAlarmElementMapping(IAlarmElementMapping alarmElementMapping)
          Set the alarm-element mapping object for this alarm box.
 void setRemoveAlarmWhenAlarmIsCleared(boolean removeAlarmWhenAlarmIsCleared)
          Set the flag value whether the alarm object will be removed from the alarm box when this alarm severity/status is changed to "cleared".
 void setRemoveAlarmWhenElementIsRemoved(boolean removeAlarmWhenElementIsRemoved)
          Set the flag value which is used to indicate that whether all alarms occured on an element need to be removed as well when the element is removed from the element box.
 
Methods inherited from class twaver.model.DataBox
beforeDataPropertyChange, doAdd, doRemove, forEachByBreadthFirst, forEachByDepthFirst, forEachByDepthFirstReverse, getDataChangeDispatcher, getParentChangeDispatcher, getRandomData, getRoots, getSelectionChangeDispatcher, getSelectionModel, onClear, onDataPropertyChange, onParentChange, onRemove, toRoots
 
Methods inherited from class twaver.model.HashCollection
_remove, accept, add, add, clearAll, getFilterDispatcher, getListChangeDispatcher, remove, setIndex, setListener
 
Methods inherited from class twaver.model.HashList
add, add, add, addAll, addLast, clear, contains, contains, containsAll, containsById, forEach, forEach, forEachReverse, getById, getByIndex, getDatas, getLastData, indexOf, isEmpty, iterator, remove, remove, removeAll, removeById, removeByIndex, retainAll, reverseIterator, set, set, size, sort, toArray, toArray, toDatas, toDatas
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface twaver.core.model.IHashCollection
getListChangeDispatcher
 
Methods inherited from interface twaver.core.model.IHashList
add, add, add, add, clearAll, contains, containsById, forEach, forEachReverse, getById, getByIndex, getDatas, getLastData, indexOf, isEmpty, remove, remove, removeById, reverseIterator, set, set, setIndex, size, toDatas
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface twaver.filter.IFilter
accept
 
Methods inherited from interface twaver.event.IHandler
setListener
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

AlarmBox

public AlarmBox(ElementBox elementBox)
Constructor of AlarmBox. This alarm box will connect to the given ElementBox.

Method Detail

getElementBox

public ElementBox getElementBox()
Get the element box this alarm box connect to. Every alarm box will work with an element box which is specified by the constructor.


isRemoveAlarmWhenElementIsRemoved

public boolean isRemoveAlarmWhenElementIsRemoved()
The flag value indicates that whether all alarms occured on an element need to be removed as well when the element is removed from the element box.

Returns:
true means will remove related alarms when an element is removed, false otherwise.

setRemoveAlarmWhenElementIsRemoved

public void setRemoveAlarmWhenElementIsRemoved(boolean removeAlarmWhenElementIsRemoved)
Set the flag value which is used to indicate that whether all alarms occured on an element need to be removed as well when the element is removed from the element box.

Parameters:
removeAlarmWhenElementIsRemoved - true means will remove related alarms when an element is removed, false otherwise.

isRemoveAlarmWhenAlarmIsCleared

public boolean isRemoveAlarmWhenAlarmIsCleared()
Indicates whether the alarm object will be removed from alarm box when this alarm severity/status is changed to "cleared".

Returns:
true means the alarm will be removed when alarm status changed to cleared, false otherwise.

setRemoveAlarmWhenAlarmIsCleared

public void setRemoveAlarmWhenAlarmIsCleared(boolean removeAlarmWhenAlarmIsCleared)
Set the flag value whether the alarm object will be removed from the alarm box when this alarm severity/status is changed to "cleared".

Parameters:
removeAlarmWhenAlarmIsCleared - true when the alarm need to be removed when alarm status changed to cleared, false otherwise.

getAlarmElementMapping

public IAlarmElementMapping getAlarmElementMapping()
Get the alarm-elemen mapping object. Alarm-element mapping object is used to map the relationship between elements and alarms. It will determines which alarm is occured on which element.

Returns:
the alarm-element mapping object.
See Also:
AlarmElementMapping

setAlarmElementMapping

public void setAlarmElementMapping(IAlarmElementMapping alarmElementMapping)
Set the alarm-element mapping object for this alarm box. The alarm-element mapping object is used to map the relationship between elements and alarms. It will determines which alarm is occured on which element.

Parameters:
alarmElementMapping - the alarm-element mapping object.
See Also:
IAlarmElementMapping

getCorrespondingAlarms

public java.util.List<Alarm> getCorrespondingAlarms(Element element)
Get the corresponding alarms of the given element, that is, all alarms occured on this element object.

Parameters:
element - The element object

getCorrespondingElements

public java.util.List<Element> getCorrespondingElements(Alarm alarm)
Get all corresponding elements by given the alarm object. This is a wrapped method of alarmElementMapping.getCorrespondingElements(alarm) See more information about this method on classAlarmElementMapping.getCorrespondingElements

Parameters:
alarm - alarm object
Returns:
all corresponding elements of this given alarm.

removeByElement

public void removeByElement(Element element)
Remove all corresponding alarms of given element object.

Parameters:
element - an element object

onAdd

protected void onAdd(int index,
                     Alarm data)
Description copied from class: DataBox
添加元素

Overrides:
onAdd in class DataBox<Alarm>
Parameters:
index - 序号
data - 元素