/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 0.9.7</a>, using an XML
 * Schema.
 * $Id$
 */

package com.queplix.core.modules.eqlext.jxb.gr.types;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
 * The possible aggregate functions of entity field
 * 
 * @version $Revision$ $Date$
 */
public class AggregateSType implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * The max type
     */
    public static final int MAX_TYPE = 0;

    /**
     * The instance of the max type
     */
    public static final AggregateSType MAX = new AggregateSType(MAX_TYPE, "max");

    /**
     * The min type
     */
    public static final int MIN_TYPE = 1;

    /**
     * The instance of the min type
     */
    public static final AggregateSType MIN = new AggregateSType(MIN_TYPE, "min");

    /**
     * The count type
     */
    public static final int COUNT_TYPE = 2;

    /**
     * The instance of the count type
     */
    public static final AggregateSType COUNT = new AggregateSType(COUNT_TYPE, "count");

    /**
     * Field _memberTable
     */
    private static java.util.Hashtable _memberTable = init();

    /**
     * Field type
     */
    private int type = -1;

    /**
     * Field stringValue
     */
    private java.lang.String stringValue = null;


      //----------------/
     //- Constructors -/
    //----------------/

    private AggregateSType(int type, java.lang.String value) 
     {
        super();
        this.type = type;
        this.stringValue = value;
    } //-- com.queplix.core.modules.eqlext.jxb.gr.types.AggregateSType(int, java.lang.String)


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method enumerate
     * 
     * Returns an enumeration of all possible instances of
     * AggregateSType
     * 
     * @return Enumeration
     */
    public static java.util.Enumeration enumerate()
    {
        return _memberTable.elements();
    } //-- java.util.Enumeration enumerate() 

    /**
     * Method getType
     * 
     * Returns the type of this AggregateSType
     * 
     * @return int
     */
    public int getType()
    {
        return this.type;
    } //-- int getType() 

    /**
     * Method init
     * 
     * 
     * 
     * @return Hashtable
     */
    private static java.util.Hashtable init()
    {
        Hashtable members = new Hashtable();
        members.put("max", MAX);
        members.put("min", MIN);
        members.put("count", COUNT);
        return members;
    } //-- java.util.Hashtable init() 

    /**
     * Method readResolve
     * 
     *  will be called during deserialization to replace the
     * deserialized object with the correct constant instance.
     * <br/>
     * 
     * @return Object
     */
    private java.lang.Object readResolve()
    {
        return valueOf(this.stringValue);
    } //-- java.lang.Object readResolve() 

    /**
     * Method toString
     * 
     * Returns the String representation of this AggregateSType
     * 
     * @return String
     */
    public java.lang.String toString()
    {
        return this.stringValue;
    } //-- java.lang.String toString() 

    /**
     * Method valueOf
     * 
     * Returns a new AggregateSType based on the given String
     * value.
     * 
     * @param string
     * @return AggregateSType
     */
    public static com.queplix.core.modules.eqlext.jxb.gr.types.AggregateSType valueOf(java.lang.String string)
    {
        java.lang.Object obj = null;
        if (string != null) obj = _memberTable.get(string);
        if (obj == null) {
            String err = "'" + string + "' is not a valid AggregateSType";
            throw new IllegalArgumentException(err);
        }
        return (AggregateSType) obj;
    } //-- com.queplix.core.modules.eqlext.jxb.gr.types.AggregateSType valueOf(java.lang.String) 

}
