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 VirtualListViewRequest 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 VirtualListViewRequestStates implements States
034{
035    /** Initial state */
036    START_STATE,
037    
038    /** VirtualListViewRequest ::= SEQUENCE  transition */
039    VLV_SEQUENCE_STATE,
040    
041    /** beforeCount    INTEGER (0..maxInt) transition */
042    VLV_BEFORE_COUNT_STATE,
043    
044    /** afterCount     INTEGER (0..maxInt) transition */
045    VLV_AFTER_COUNT_STATE,
046    
047    /** byOffset        [0] SEQUENCE transition */
048    VLV_TARGET_BY_OFFSET_STATE,
049    
050    /** offset          INTEGER (1 .. maxInt) transition */
051    VLV_OFFSET_STATE,
052    
053    /** contentCount    INTEGER (0 .. maxInt) transition */
054    VLV_CONTENT_COUNT_STATE,
055    
056    /** contextID     OCTET STRING OPTIONAL transition */
057    VLV_CONTEXT_ID_STATE,
058    
059    /** greaterThanOrEqual [1] AssertionValue  transition */
060    VLV_ASSERTION_VALUE_STATE,
061    
062    /** Final state */
063    END_STATE;
064
065    /**
066     * Get the grammar name
067     * 
068     * @return The grammar name
069     */
070    public String getGrammarName()
071    {
072        return "VLV_REQUEST_GRAMMAR";
073    }
074
075
076    /**
077     * Get the string representing the state
078     * 
079     * @param state The state number
080     * @return The String representing the state
081     */
082    public String getState( int state )
083    {
084        return ( state == END_STATE.ordinal() ) ? "VLV_REQUEST_END_STATE" : name();
085    }
086
087
088    @Override
089    public boolean isEndState()
090    {
091        return this == END_STATE;
092    }
093
094
095    @Override
096    public Enum<?> getStartState()
097    {
098        return START_STATE;
099    }
100}