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 */ 020package org.apache.directory.api.ldap.codec.controls.search.subentries; 021 022 023import org.apache.directory.api.asn1.ber.grammar.States; 024 025 026/** 027 * This class store the SubEntryControl's grammar constants. It is also used for 028 * debugging purposes. 029 * 030 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 031 */ 032public enum SubentriesStates implements States 033{ 034 // ~ Static fields/initializers 035 // ----------------------------------------------------------------- 036 037 /** The END_STATE */ 038 END_STATE, 039 040 // ========================================================================= 041 // Sub entry control grammar states 042 // ========================================================================= 043 044 /** Starting state */ 045 START_STATE, 046 047 /** Visibility Value */ 048 SUB_ENTRY_VISIBILITY_STATE, 049 050 /** terminal state */ 051 LAST_SUB_ENTRY_STATE; 052 053 /** 054 * Get the grammar name 055 * 056 * @return The grammar name 057 */ 058 public String getGrammarName() 059 { 060 return "SUB_ENTRY_GRAMMAR"; 061 } 062 063 064 /** 065 * Get the string representing the state 066 * 067 * @param state The state number 068 * @return The String representing the state 069 */ 070 public String getState( int state ) 071 { 072 return ( state == END_STATE.ordinal() ) ? "SUB_ENTRY_END_STATE" : name(); 073 } 074 075 076 /** 077 * {@inheritDoc} 078 */ 079 @Override 080 public boolean isEndState() 081 { 082 return this == END_STATE; 083 } 084 085 086 /** 087 * {@inheritDoc} 088 */ 089 @Override 090 public SubentriesStates getStartState() 091 { 092 return START_STATE; 093 } 094}