
    
package performa.orm.types;

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



/**
 * 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 transient String CSSClass;

    private transient String DotCSSClass;

    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 String getCSSClass()
    {
    return CSSClass;
    }

    public String getDotCSSClass()
    {
    return DotCSSClass;
    }
    
    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;
        RED.CSSClass = "red-b";
        RED.DotCSSClass = "red-dot";
        AMBER.ColorRank = 2;
        AMBER.RatingScore = 5;
        AMBER.CSSClass = "yellow-b";
        AMBER.DotCSSClass = "yellow-dot";
        GREEN.ColorRank = 1;
        GREEN.RatingScore = 10;
        GREEN.CSSClass = "green-b";
        GREEN.DotCSSClass = "green-dot";
        
    }


    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()));
        attribs.put ("CSSClass", ArrayFormatter.toObject(getCSSClass()));
        attribs.put ("DotCSSClass", ArrayFormatter.toObject(getDotCSSClass()));
        
        return attribs;
    }
    
    public static class ColorCodePipeLineFactory<From, Me extends ColorCode> extends AbstractEnumerated.EnumPipeLine<From, Me>
    {
        public <Prev> ColorCodePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
        {
            super (pipeLine, nextPipe);
        }
        
        public ColorCodePipeLineFactory (From seed)
        {
            super(seed);
        }

        public ColorCodePipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("ColorRank"))
            {
                return toColorRank ();
            }
            if (name.equals ("RatingScore"))
            {
                return toRatingScore ();
            }
            if (name.equals ("CSSClass"))
            {
                return toCSSClass ();
            }
            if (name.equals ("DotCSSClass"))
            {
                return toDotCSSClass ();
            }
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Integer> toColorRank () { return pipe(new EnumAttributePipe<Me, Integer>("ColorRank")); }
        
        public PipeLine<From, Integer> toRatingScore () { return pipe(new EnumAttributePipe<Me, Integer>("RatingScore")); }
        
        public PipeLine<From, String> toCSSClass () { return pipe(new EnumAttributePipe<Me, String>("CSSClass")); }
        
        public PipeLine<From, String> toDotCSSClass () { return pipe(new EnumAttributePipe<Me, String>("DotCSSClass")); }
    }
}

