001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *  
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *  
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License. 
018 *  
019 */
020
021package org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure;
022
023
024import org.apache.directory.api.asn1.ber.grammar.States;
025
026
027/**
028 * Constants for StoredProcedureGrammar.
029 * 
030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
031 */
032public enum StoredProcedureStatesEnum implements States
033{
034    //~ Static fields/initializers -----------------------------------------------------------------
035
036    /** The END_STATE */
037    END_STATE,
038
039    //=========================================================================
040    // StoredProcedure
041    //=========================================================================
042    /** starting state */
043    START_STATE,
044
045    /** StoredProcedure */
046    STORED_PROCEDURE_STATE,
047
048    // Language ---------------------------------------------------------------
049    /** Language */
050    LANGUAGE_STATE,
051
052    // Procedure --------------------------------------------------------------
053    /** Procedure */
054    PROCEDURE_STATE,
055
056    // Parameters -------------------------------------------------------------
057    /** Parameters */
058    PARAMETERS_STATE,
059
060    // Parameter --------------------------------------------------------------
061    /** Parameter */
062    PARAMETER_STATE,
063
064    // Parameter type ---------------------------------------------------------
065    /** Parameter type */
066    PARAMETER_TYPE_STATE,
067
068    // Parameters value -------------------------------------------------------
069    /** Parameter value */
070    PARAMETER_VALUE_STATE,
071
072    /** Last Stored Procedure */
073    LAST_STORED_PROCEDURE_STATE;
074
075    /**
076     * Get the grammar name
077     *
078     * @return The grammar name
079     */
080    public String getGrammarName()
081    {
082        return "STORED_PROCEDURE_GRAMMAR";
083    }
084
085
086    /**
087     * Get the string representing the state
088     * 
089     * @param state The state number
090     * @return The String representing the state
091     */
092    public String getState( int state )
093    {
094        return ( state == END_STATE.ordinal() ) ? "STORED_PROCEDURE_END_STATE" : name();
095    }
096
097
098    /**
099     * {@inheritDoc}
100     */
101    @Override
102    public boolean isEndState()
103    {
104        return this == END_STATE;
105    }
106
107
108    /**
109     * {@inheritDoc}
110     */
111    @Override
112    public StoredProcedureStatesEnum getStartState()
113    {
114        return START_STATE;
115    }
116}