@Test public void testMoreSevere() { assertTrue(AlarmServer.moreSevere(MonitoringResult.CRITICAL, MonitoringResult.WARNING)); assertFalse(AlarmServer.moreSevere(MonitoringResult.WARNING, MonitoringResult.CRITICAL)); assertFalse(AlarmServer.moreSevere(MonitoringResult.CRITICAL, MonitoringResult.CRITICAL)); }
protected static boolean moreSevere(Object newValue, Object oldValue) { if (newValue instanceof ParameterValue) { return moreSevere(((ParameterValue) newValue).getMonitoringResult(), ((ParameterValue) oldValue).getMonitoringResult()); } else if (newValue instanceof Event) { return moreSevere(((Event) newValue).getSeverity(), ((Event) oldValue).getSeverity()); } else { throw new IllegalStateException(); } }
AlarmServer extends AbstractService { protected static boolean moreSevere(Object newValue, Object oldValue) { if (newValue instanceof ParameterValue) { return moreSevere(((ParameterValue) newValue).getMonitoringResult(), ((ParameterValue) oldValue).getMonitoringResult()); } else if (newValue instanceof Event) { return moreSevere(((Event) newValue).getSeverity(), ((Event) oldValue).getSeverity()); } else { throw new IllegalStateException(); } } }
AlarmServer extends AbstractService { protected static boolean moreSevere(Object newValue, Object oldValue) { if (newValue instanceof ParameterValue) { return moreSevere(((ParameterValue) newValue).getMonitoringResult(), ((ParameterValue) oldValue).getMonitoringResult()); } else if (newValue instanceof Event) { return moreSevere(((Event) newValue).getSeverity(), ((Event) oldValue).getSeverity()); } else { throw new IllegalStateException(); } } AlarmServer(String yamcsInstance, ScheduledThreadPoolExecutor timer); }
AlarmServer extends AbstractService { protected static boolean moreSevere(Object newValue, Object oldValue) { if (newValue instanceof ParameterValue) { return moreSevere(((ParameterValue) newValue).getMonitoringResult(), ((ParameterValue) oldValue).getMonitoringResult()); } else if (newValue instanceof Event) { return moreSevere(((Event) newValue).getSeverity(), ((Event) oldValue).getSeverity()); } else { throw new IllegalStateException(); } } AlarmServer(String yamcsInstance, ScheduledThreadPoolExecutor timer); Map<S, ActiveAlarm<T>> addAlarmListener(AlarmListener<T> listener); void removeAlarmListener(AlarmListener<T> listener); Map<S, ActiveAlarm<T>> getActiveAlarms(); ActiveAlarm<T> getActiveAlarm(S subject, int id); ActiveAlarm<T> getActiveAlarm(S subject); ActiveAlarm<T> acknowledge(ActiveAlarm<T> alarm, String username, long ackTime, String message); ActiveAlarm<T> reset(ActiveAlarm<T> alarm, String username, long resetTime, String message); ActiveAlarm<T> clear(ActiveAlarm<T> alarm, String username, long clearTime, String message); ActiveAlarm<T> shelve(ActiveAlarm<T> alarm, String username, String message,
            long shelveDuration); ActiveAlarm<T> unshelve(ActiveAlarm<T> alarm, String username); @Override void doStart(); void update(T pv, int minViolations); void update(T value, int minViolations, boolean autoAck, boolean latching); @Override void doStop(); void clearAll(); }
AlarmServer extends AbstractService { protected static boolean moreSevere(Object newValue, Object oldValue) { if (newValue instanceof ParameterValue) { return moreSevere(((ParameterValue) newValue).getMonitoringResult(), ((ParameterValue) oldValue).getMonitoringResult()); } else if (newValue instanceof Event) { return moreSevere(((Event) newValue).getSeverity(), ((Event) oldValue).getSeverity()); } else { throw new IllegalStateException(); } } AlarmServer(String yamcsInstance, ScheduledThreadPoolExecutor timer); Map<S, ActiveAlarm<T>> addAlarmListener(AlarmListener<T> listener); void removeAlarmListener(AlarmListener<T> listener); Map<S, ActiveAlarm<T>> getActiveAlarms(); ActiveAlarm<T> getActiveAlarm(S subject, int id); ActiveAlarm<T> getActiveAlarm(S subject); ActiveAlarm<T> acknowledge(ActiveAlarm<T> alarm, String username, long ackTime, String message); ActiveAlarm<T> reset(ActiveAlarm<T> alarm, String username, long resetTime, String message); ActiveAlarm<T> clear(ActiveAlarm<T> alarm, String username, long clearTime, String message); ActiveAlarm<T> shelve(ActiveAlarm<T> alarm, String username, String message,
            long shelveDuration); ActiveAlarm<T> unshelve(ActiveAlarm<T> alarm, String username); @Override void doStart(); void update(T pv, int minViolations); void update(T value, int minViolations, boolean autoAck, boolean latching); @Override void doStop(); void clearAll();  }