
    
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 LocationRadius extends AbstractEnumerated
{
    
    public static final EnumeratedFactory FACTORY_LocationRadius = new LocationRadiusFactory();
    
    public static final LocationRadius KM30 = new LocationRadius ("KM30", "KM30", "30km/20mi", false);
    
    public static final LocationRadius KM60 = new LocationRadius ("KM60", "KM60", "60km/40mi", false);
    
    public static final LocationRadius KM100 = new LocationRadius ("KM100", "KM100", "100km/65mi", false);

    private static final LocationRadius[] allLocationRadiuss =
        new LocationRadius[] { KM30,KM60,KM100};


    private static LocationRadius[] getAllLocationRadiuss ()
    {
        return allLocationRadiuss;
    }

    private transient Integer DistanceInKM;

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

    public Integer getDistanceInKM()
    {
    return DistanceInKM;
    }
    
    public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allLocationRadiuss);



    static
    {
        defineAdditionalData ();
    }

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

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


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


    public EnumeratedFactory getFactory ()
    {
        return FACTORY_LocationRadius;
    }

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

        LocationRadius[] all = getAllLocationRadiuss();
        int enumIndex = AbstractEnumerated.getIndexForName (all, name);

        return all[enumIndex];
    }


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

        LocationRadius[] all = getAllLocationRadiuss();
        int enumIndex = AbstractEnumerated.getIndexForValue (getAllLocationRadiuss (), value);

        return all[enumIndex];
    }


    public static java.util.Enumeration getAll ()
    {
        return AbstractEnumerated.getAll (getAllLocationRadiuss());
    }
    
    
    public static LocationRadius[] getLocationRadiusArray ()
    {
        return (LocationRadius[])getAllLocationRadiuss().clone ();
    }


    public static void defineAdditionalData ()
    {
        KM30.DistanceInKM = 30;
        KM60.DistanceInKM = 60;
        KM100.DistanceInKM = 100;
        
    }


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

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

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


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

        attribs.put ("DistanceInKM", ArrayFormatter.toObject(getDistanceInKM()));
        
        return attribs;
    }
    
    public static class LocationRadiusPipeLineFactory<From, Me extends LocationRadius> extends AbstractEnumerated.EnumPipeLine<From, Me>
    {
        public <Prev> LocationRadiusPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
        {
            super (pipeLine, nextPipe);
        }
        
        public LocationRadiusPipeLineFactory (From seed)
        {
            super(seed);
        }

        public LocationRadiusPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("DistanceInKM"))
            {
                return toDistanceInKM ();
            }
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Integer> toDistanceInKM () { return pipe(new EnumAttributePipe<Me, Integer>("DistanceInKM")); }
    }
}

