
    
package performa.orm.types;

import java.util.*;
import oneit.utils.*;



/**
 * This class was generated using constGen.bat.
 * DO NOT MODIFY THIS CODE.
 * Edit the associated .xml file, and regenerate this file
 * constGen (directory) (file minus extension)
 * e.g. constGen C:\...\sql FieldType
 */

public class ColorCode extends AbstractEnumerated
{
    
    public static final EnumeratedFactory FACTORY_ColorCode = new ColorCodeFactory();
    
    public static final ColorCode RED = new ColorCode ("RED", "RED", "Red", false);
    
    public static final ColorCode AMBER = new ColorCode ("AMBER", "AMBER", "Amber", false);
    
    public static final ColorCode GREEN = new ColorCode ("GREEN", "GREEN", "Green", false);

    private static final ColorCode[] allColorCodes =
        new ColorCode[] { RED,AMBER,GREEN};


    private static ColorCode[] getAllColorCodes ()
    {
        return allColorCodes;
    }

    private transient Integer ColorRank;

    private transient Integer RatingScore;

    private ColorCode (String name, String value, String description, boolean disabled)
    {
        super (name, value, description, disabled);
    }

    public Integer getColorRank()
    {
    return ColorRank;
    }

    public Integer getRatingScore()
    {
    return RatingScore;
    }
    
    public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allColorCodes);



    static
    {
        defineAdditionalData ();
    }

    public boolean isEqual (ColorCode other)
    {
    return this.name.equals (other.name);
    }

    public Enumeration getAllInstances ()
    {
        return ColorCode.getAll ();
    }


    private Object readResolve() throws java.io.ObjectStreamException
    {
        return ColorCode.forName (this.name);
    }


    public EnumeratedFactory getFactory ()
    {
        return FACTORY_ColorCode;
    }

    public static ColorCode forName (String name)
    {
        if (name == null) { return null; }

        ColorCode[] all = getAllColorCodes();
        int enumIndex = AbstractEnumerated.getIndexForName (all, name);

        return all[enumIndex];
    }


    public static ColorCode forValue (String value)
    {
        if (value == null) { return null; }

        ColorCode[] all = getAllColorCodes();
        int enumIndex = AbstractEnumerated.getIndexForValue (getAllColorCodes (), value);

        return all[enumIndex];
    }


    public static java.util.Enumeration getAll ()
    {
        return AbstractEnumerated.getAll (getAllColorCodes());
    }
    
    
    public static ColorCode[] getColorCodeArray ()
    {
        return (ColorCode[])getAllColorCodes().clone ();
    }


    public static void defineAdditionalData ()
    {
        RED.ColorRank = 3;
        RED.RatingScore = 0;
        AMBER.ColorRank = 2;
        AMBER.RatingScore = 5;
        GREEN.ColorRank = 1;
        GREEN.RatingScore = 10;
        
    }


    static class ColorCodeFactory implements EnumeratedFactory
    {
        public AbstractEnumerated getForName (String name)
        {
            return ColorCode.forName (name);
        }

        public AbstractEnumerated getForValue (String name)
        {
            return ColorCode.forValue (name);
        }

        public Enumeration getAll ()
        {
            return ColorCode.getAll ();
        }
    }


    public Map getAdditionalAttributes ()
    {
        Map attribs = new HashMap ();

        attribs.put ("ColorRank", ArrayFormatter.toObject(getColorRank()));
        attribs.put ("RatingScore", ArrayFormatter.toObject(getRatingScore()));
        
        return attribs;
    }
}

