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