Package org.epics.vtype
Class Alarm
- java.lang.Object
-
- org.epics.vtype.Alarm
-
public abstract class Alarm extends Object
Alarm information. Represents the severity and name of the highest alarm associated with the channel.- Author:
- carcassi
-
-
Constructor Summary
Constructors Constructor Description Alarm()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Alarm
alarmOf(Object value)
Null and non-VType safe utility to extract alarm information.static Alarm
alarmOf(Object value, boolean connected)
Null and non-VType safe utility to extract alarm information for a connection.static Alarm
disconnected()
Alarm condition for when a channel is disconnected.boolean
equals(Object obj)
Tests whether the give object is and Alarm with the same name and severity.abstract String
getName()
Returns a brief text representation of the highest currently active alarm.abstract AlarmSeverity
getSeverity()
Returns the alarm severity, which describes the quality of the value returned.abstract AlarmStatus
getStatus()
Returns the alarm status, which returns the source of the alarm.int
hashCode()
static Alarm
high()
Alarm condition for when a value is above the high warning threshold.static Alarm
highestAlarmOf(List<?> values, boolean ignoreNull)
Returns the value with highest severity.static Alarm
hihi()
Alarm condition for when a value is above the high alarm threshold.static Alarm
lolo()
Alarm condition for when a value is below the low alarm threshold.static Alarm
low()
Alarm condition for when a value is below the low warning threshold.static Alarm
none()
No alarm.static Alarm
noValue()
Alarm condition for when a value is not present.static Alarm
of(AlarmSeverity severity, AlarmStatus status, String name)
New alarm with the given severity and status.String
toString()
-
-
-
Method Detail
-
getSeverity
public abstract AlarmSeverity getSeverity()
Returns the alarm severity, which describes the quality of the value returned. Never null.- Returns:
- the alarm severity
-
getStatus
public abstract AlarmStatus getStatus()
Returns the alarm status, which returns the source of the alarm. Never null.- Returns:
- the alarm status
-
getName
public abstract String getName()
Returns a brief text representation of the highest currently active alarm. Never null.- Returns:
- the alarm status
-
equals
public final boolean equals(Object obj)
Tests whether the give object is and Alarm with the same name and severity.
-
of
public static Alarm of(AlarmSeverity severity, AlarmStatus status, String name)
New alarm with the given severity and status.- Parameters:
severity
- the alarm severitystatus
- the alarm statusname
- the alarm name- Returns:
- the new alarm
-
none
public static Alarm none()
No alarm. To be used whenever there is no alarm associated with the value.To test for no alarm, one should always check the severity, and not equality to this specific alarm: depending on the data source the status may be different and contain extra information.
- Returns:
- severity NONE and status "None"
-
hihi
public static Alarm hihi()
Alarm condition for when a value is above the high alarm threshold.- Returns:
- the HIHI alarm
-
high
public static Alarm high()
Alarm condition for when a value is above the high warning threshold.- Returns:
- the HIGH alarm
-
low
public static Alarm low()
Alarm condition for when a value is below the low warning threshold.- Returns:
- the LOW alarm
-
lolo
public static Alarm lolo()
Alarm condition for when a value is below the low alarm threshold.- Returns:
- the LOLO alarm
-
noValue
public static Alarm noValue()
Alarm condition for when a value is not present. To be used as the alarm associated to a null value.- Returns:
- severity INVALID and status "No Value"
-
disconnected
public static Alarm disconnected()
Alarm condition for when a channel is disconnected. To be used as the alarm associated with a broken connection.- Returns:
- severity UNDEFINED and status "Disconnected"
-
highestAlarmOf
public static Alarm highestAlarmOf(List<?> values, boolean ignoreNull)
Returns the value with highest severity. null values can either be ignored or treated as disconnected/missing value (noValue()
).- Parameters:
values
- a list of valuesignoreNull
- true to simply skip null values- Returns:
- the value with highest alarm; can't be null
-
alarmOf
public static Alarm alarmOf(Object value)
Null and non-VType safe utility to extract alarm information.- Parameters:
value
- the value- Returns:
- the alarm information for the value
-
alarmOf
public static Alarm alarmOf(Object value, boolean connected)
Null and non-VType safe utility to extract alarm information for a connection.- If the value is has an alarm, the associated alarm is returned.
- If the value is does not have an alarm,
none()
is returned. - If the value is null and connected is true,
noValue()
is returned. - If the value is null and disconnected is true,
disconnected()
is returned.
- Parameters:
value
- a valueconnected
- the connection status- Returns:
- the alarm information
-
-