Package org.eso.ias.types
Class Alarm
java.lang.Object
org.eso.ias.types.Alarm
Alarm
represents an alarm generated by a remote monitored system.
An alarm has
- a state, AlarmState
, of set/clear plus acknowledgement;
- a priority, Priority
.
The alarm corresponding to the initial state is returned by the empty constructor;
all other alarm states can be reached by applying methods to the start state or other alarm states.
For a description of the state machine,
see the documentation of Issue #167 on github.
An Alarm is immutable
- Author:
- acaproni
-
Field Summary
Modifier and TypeFieldDescriptionfinal AlarmState
The state of the alarmfinal Priority
The priority of the alarm -
Method Summary
Modifier and TypeMethodDescriptionack()
ACK an alarm.clear()
boolean
static Alarm
Build and return the alarm that corresponds to the start state of the alarm state machine (i.e.static Alarm
getInitialAlarmState
(Priority priority) Build and return the alarm that corresponds to the start state of the alarm state machine (i.e.int
hashCode()
Return an alarm of an increased priority if it exists, otherwise return the same alarm.boolean
isAcked()
boolean
boolean
isSet()
Return an alarm of a lowered priority if it exists, otherwise return the same alarm.set()
setIf
(boolean condition) Set or clear the alarm depending on the passed conditionsetPriority
(Priority priority) Assign a priority to the alarmtoString()
static Alarm
Build an alarm from the passed string
-
Field Details
-
alarmState
The state of the alarm -
priority
The priority of the alarm
-
-
Method Details
-
getInitialAlarmState
Build and return the alarm that corresponds to the start state of the alarm state machine (i.e. cleared, and acknowledged) with default priority.- Returns:
- the alarm of the start state of the state machine
-
getInitialAlarmState
Build and return the alarm that corresponds to the start state of the alarm state machine (i.e. cleared, and unacked) with the passed priority.- Parameters:
priority
- the priority of the alarm- Returns:
- the alarm of the start state of the state machine
-
hashCode
public int hashCode() -
equals
-
ack
ACK an alarm. It avoids building a new Alarm if the state did not change. Note: this method shall not be called by the TF because the ACK is done by the user and not programmatically by the TF. The ACK will be communicated by the oeprator GUI (or other tools) as a command that triggers the execution of this method.- Returns:
- the acked alarm or this if the alarm was already ACKed
-
set
- Returns:
- the alarm just set
-
setIf
Set or clear the alarm depending on the passed condition- Parameters:
condition
- the codnition to set/unset the alarm- Returns:
- the alarm set if condition is true, or cleared if the condition is false
-
isSet
public boolean isSet()- Returns:
- true if the alarm is set, false otherwise
-
isCleared
public boolean isCleared()- Returns:
- true if the alarm is cleared, false otherwise
-
isAcked
public boolean isAcked()- Returns:
- true if the alarm is acknowledged, false otherwise
-
clear
- Returns:
- the alarm just cleared
-
increasePriority
Return an alarm of an increased priority if it exists, otherwise return the same alarm. Increasing the priority of a#CLEARED
alarm is not allowed and the method throws an exception- Returns:
- the alarm with increased priority
-
lowerPriority
Return an alarm of a lowered priority if it exists, otherwise return the same alarm. Lowering the priority of a#CLEARED
alarm is not allowed and the method throws an exception- Returns:
- the alarm with increased priority
-
setPriority
Assign a priority to the alarm- Parameters:
priority
- the priority to assign to the alarm- Returns:
- the alarm with the new priority or this if its priority matches with the passed priority
-
toString
-
valueOf
Build an alarm from the passed string- Parameters:
value
- The string encoding the alarm- Returns:
- the alarm buit from the string
-