Class Alarm

java.lang.Object
org.eso.ias.types.Alarm

public class Alarm extends Object
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 Details

    • alarmState

      public final AlarmState alarmState
      The state of the alarm
    • priority

      public final Priority priority
      The priority of the alarm
  • Method Details

    • getInitialAlarmState

      public static Alarm 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

      public static Alarm getInitialAlarmState(Priority priority)
      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()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • ack

      public Alarm 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

      public Alarm set()
      Returns:
      the alarm just set
    • setIf

      public Alarm setIf(boolean condition)
      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

      public Alarm clear()
      Returns:
      the alarm just cleared
    • increasePriority

      public Alarm 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

      public Alarm 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

      public Alarm setPriority(Priority priority)
      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

      public String toString()
      Overrides:
      toString in class Object
    • valueOf

      public static Alarm valueOf(String value)
      Build an alarm from the passed string
      Parameters:
      value - The string encoding the alarm
      Returns:
      the alarm buit from the string