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.controls.vlv_impl;
022
023
024import org.apache.directory.api.asn1.ber.grammar.States;
025
026
027/**
028 * This class store the VirtualListViewResponse grammar constants. It is also used for
029 * debugging purposes.
030 *
031 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032 */
033public enum VirtualListViewResponseStates implements States
034{
035    /** Initial state */
036    START_STATE,
037    
038    /** VirtualListViewResponse ::= SEQUENCE transition */
039    VLV_SEQUENCE_STATE,
040    
041    /** targetPosition    INTEGER (0 .. maxInt) transition */
042    VLV_TARGET_POSITION_STATE,
043
044    /** contentCount     INTEGER (0 .. maxInt) transition */
045    VLV_CONTENT_COUNT_STATE,
046
047    /** virtualListViewResult ENUMERATED transition */
048    VLV_VIRTUAL_LIST_VIEW_RESULT_STATE,
049
050    /** contextID     OCTET STRING OPTIONAL transition */
051    VLV_CONTEXT_ID_STATE,
052    
053    /** Final state */
054    END_STATE;
055
056    /**
057     * Get the grammar name
058     * 
059     * @return The grammar name
060     */
061    public String getGrammarName()
062    {
063        return "VLV_RESPONSE_GRAMMAR";
064    }
065
066
067    /**
068     * Get the string representing the state
069     * 
070     * @param state The state number
071     * @return The String representing the state
072     */
073    public String getState( int state )
074    {
075        return ( state == END_STATE.ordinal() ) ? "VLV_RESPONSE_END_STATE" : name();
076    }
077
078
079    @Override
080    public boolean isEndState()
081    {
082        return this == END_STATE;
083    }
084
085
086    @Override
087    public Enum<?> getStartState()
088    {
089        return START_STATE;
090    }
091}