/**
 * Copyright (C) 2010-12 Brookhaven National Laboratory
 * All rights reserved. Use is subject to license terms.
 */
package org.epics.vtype;

/**
 * Severity of an alarm.
 * <p>
 * Values are provided in order of increasing severity, so you can rely on
 * {@link #ordinal() } and {@link #compareTo(java.lang.Enum) } for comparison
 * and ordering. In case additional AlarmSeverity values are added in the future,
 * which is very unlikely, they will be added in order as well.
 * <p>
 * One should always bear in mind that the alarm severity of the IOC is set on
 * the record, and not on the individual channel. If  one is not connecting
 * to the value field of the record, the severity does not reflect the state
 * of that field.
 * <p>
 * For example: a record may be INVALID meaning that the value of the field
 * was not correctly read by the hardware; if one connects to the display limit
 * field, the value of that field will still be ok, but the alarm severity (if
 * requested) would say INVALID.
 *
 * @author carcassi
 */
public enum AlarmSeverity {
    
    /**
     * The current value is valid, and there is no alarm.
     */
    NONE,
    
    /**
     * There is a minor problem with the value: the exact meaning is defined
     * by the channel, but typically this means that the value is valid and is
     * outside some working range.
     */
    MINOR,

    /**
     * There is a major problem with the value: the exact meaning is defined
     * by the channel, but typically this means that the value is valid and is
     * outside some working range.
     */
    MAJOR,
    
    /**
     * There is a major problem with the value itself: the exact meaning is defined
     * by the channel, but typically this means that the returned value is not a
     * real representation of the actual value.
     */
    INVALID,

    /**
     * The channel cannot be read and its state is undefined: the exact meaning is defined
     * by the channel, but typically this means that the client is either disconnected
     * or connected with no read access. The value is either stale or invalid.
     */
    UNDEFINED;
}

@@ -140,16 +140,71 @@
 vtype;%0A%0A
+import java.util.AbstractList;%0Aimport java.util.List;%0A%0A
 /**%0A * S
@@ -2184,10 +2184,603 @@
 EFINED;%0A
+    %0A    private static final List%3CString%3E labels = new AbstractList%3CString%3E() %7B%0A        @Override%0A        public String get(int index) %7B%0A            return AlarmSeverity.values()%5Bindex%5D.name();%0A        %7D%0A%0A        @Override%0A        public int size() %7B%0A            return AlarmSeverity.values().length;%0A        %7D%0A    %7D;%0A    %0A    /**%0A     * Returns the list of labels for the severity.%0A     * %3Cp%3E%0A     * This is useful to create VEnums containing severities.%0A     * %0A     * @return an immutable list with the labels%0A     */%0A    public static List%3CString%3E labels() %7B%0A        return labels;%0A    %7D%0A
 %7D%0A

update to SNAPSHOT