public class AlarmsContainer
extends java.lang.Object
It is composed of 2 collections:
HashMap stores each entry accessed by its alarmID (the key)
Vector of Strings used to remember the position of
each alarm when the max number of alarms has been reached
It also allows to access the alarms by row
Synchronization is done by thread confinement (inside the EDT). Invocation of read only methods must be done inside the EDT.
| Modifier and Type | Class and Description |
|---|---|
class |
AlarmsContainer.AlarmContainerException
The exception generated by the Alarm Container
|
| Modifier | Constructor and Description |
|---|---|
protected |
AlarmsContainer(int max)
Build an AlarmContainer
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(AlarmTableEntry entry)
Add an entry (i.e a alarm) in the collection.
|
protected void |
clear()
Remove all the elements in the container
|
boolean |
contains(java.lang.String alarmID)
Check if an alarm with the given ID is in the container
|
AlarmTableEntry |
get(int pos)
Return the entry in the given position
|
AlarmTableEntry |
get(java.lang.String id)
Return the entry with the given ID
|
protected int |
hasNotAckAlarms()
Check if the container has alarm not yet acknowledged.
|
protected void |
remove(AlarmTableEntry entry)
Remove the entry for the passed alarm
|
protected int |
removeInactiveAlarms(AlarmGUIType type)
Remove all the inactive alarms of a given type.
|
protected AlarmTableEntry |
removeOldest()
Remove the oldest entry in the container
|
protected void |
replace(AlarmTableEntry newAlarm)
Replace the alarm in a row with passed one.
|
int |
size()
Return the number of alarms in the container.
|
protected AlarmsContainer(int max)
max - The max number of alarms to store in the containerpanel - The AlarmPanelpublic int size()
protected void add(AlarmTableEntry entry) throws AlarmsContainer.AlarmContainerException
If there is no room available in the container, an exception is thrown. Checking if there is enough room must be done by the caller.
alarm - The not null entry to addAlarmsContainer.AlarmContainerExceptionpublic boolean contains(java.lang.String alarmID)
alarmID - The ID of the alarmpublic AlarmTableEntry get(int pos)
pos - The position of the alarm in the containerreduced - true if the alarms in the table are reducedpublic AlarmTableEntry get(java.lang.String id)
id - The not null ID of the alarm in the containernullif the container does not contain an entry for the given idprotected void clear()
protected AlarmTableEntry removeOldest() throws AlarmsContainer.AlarmContainerException
AlarmsContainer.AlarmContainerException - If the container is emptyprotected void remove(AlarmTableEntry entry) throws AlarmsContainer.AlarmContainerException
entry - The alarm whose entry must be removedAlarmsContainer.AlarmContainerException - If the alarm is not in the containerprotected int removeInactiveAlarms(AlarmGUIType type) throws AlarmsContainer.AlarmContainerException
If the type is INACTIVE all inactive alarms are deleted regardless of their priority
type - The type of the inactive alarmsAlarmsContainer.AlarmContainerExceptionprotected void replace(AlarmTableEntry newAlarm) throws AlarmsContainer.AlarmContainerException
The entry to replace the alarm is given by the alarm ID of the parameter.
newAlarm - The not null new alarmAlarmsContainer.AlarmContainerException - if the entry is not in the containerprotected int hasNotAckAlarms()
throws AlarmsContainer.AlarmContainerException
If there are alarms to be acknowledged by the user, this method returns the highest of their priorities. Note that for alarm system the highest priority is 0 and lowest is 3.
AlarmsContainer.AlarmContainerException - in case of error getting the highest priority to ack