001/**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019package org.apache.hadoop.hbase.filter;
020
021import java.nio.ByteBuffer;
022
023import org.apache.yetus.audience.InterfaceAudience;
024
025/**
026 * ParseConstants holds a bunch of constants related to parsing Filter Strings
027 * Used by {@link ParseFilter}
028 */
029@InterfaceAudience.Public
030public final class ParseConstants {
031
032  /**
033   * ASCII code for LPAREN
034   */
035  public static final int LPAREN = '(';
036
037  /**
038   * ASCII code for RPAREN
039   */
040  public static final int RPAREN = ')';
041
042  /**
043   * ASCII code for whitespace
044   */
045  public static final int WHITESPACE = ' ';
046
047  /**
048   * ASCII code for tab
049   */
050  public static final int TAB = '\t';
051
052  /**
053   * ASCII code for 'A'
054   */
055  public static final int A = 'A';
056
057  /**
058   * ASCII code for 'N'
059   */
060  public static final int N = 'N';
061
062  /**
063   * ASCII code for 'D'
064   */
065  public static final int D = 'D';
066
067  /**
068   * ASCII code for 'O'
069   */
070  public static final int O = 'O';
071
072  /**
073   * ASCII code for 'R'
074   */
075  public static final int R = 'R';
076
077  /**
078   * ASCII code for 'S'
079   */
080  public static final int S = 'S';
081
082  /**
083   * ASCII code for 'K'
084   */
085  public static final int K = 'K';
086
087  /**
088   * ASCII code for 'I'
089   */
090  public static final int I = 'I';
091
092  /**
093   * ASCII code for 'P'
094   */
095  public static final int P = 'P';
096
097  /**
098   * SKIP Array
099   */
100  public static final byte [] SKIP_ARRAY = new byte [ ] {'S', 'K', 'I', 'P'};
101  public static final ByteBuffer SKIP_BUFFER = ByteBuffer.wrap(SKIP_ARRAY);
102
103  /**
104   * ASCII code for 'W'
105   */
106  public static final int W = 'W';
107
108  /**
109   * ASCII code for 'H'
110   */
111  public static final int H = 'H';
112
113  /**
114   * ASCII code for 'L'
115   */
116  public static final int L = 'L';
117
118  /**
119   * ASCII code for 'E'
120   */
121  public static final int E = 'E';
122
123  /**
124   * WHILE Array
125   */
126  public static final byte [] WHILE_ARRAY = new byte [] {'W', 'H', 'I', 'L', 'E'};
127  public static final ByteBuffer WHILE_BUFFER = ByteBuffer.wrap(WHILE_ARRAY);
128
129  /**
130   * OR Array
131   */
132  public static final byte [] OR_ARRAY = new byte [] {'O','R'};
133  public static final ByteBuffer OR_BUFFER = ByteBuffer.wrap(OR_ARRAY);
134
135  /**
136   * AND Array
137   */
138  public static final byte [] AND_ARRAY = new byte [] {'A','N', 'D'};
139  public static final ByteBuffer AND_BUFFER = ByteBuffer.wrap(AND_ARRAY);
140
141  /**
142   * ASCII code for Backslash
143   */
144  public static final int BACKSLASH = '\\';
145
146  /**
147   * ASCII code for a single quote
148   */
149  public static final int SINGLE_QUOTE = '\'';
150
151  /**
152   * ASCII code for a comma
153   */
154  public static final int COMMA = ',';
155
156  /**
157   * LESS_THAN Array
158   */
159  public static final byte [] LESS_THAN_ARRAY = new byte [] {'<'};
160  public static final ByteBuffer LESS_THAN_BUFFER = ByteBuffer.wrap(LESS_THAN_ARRAY);
161
162  /**
163   * LESS_THAN_OR_EQUAL_TO Array
164   */
165  public static final byte [] LESS_THAN_OR_EQUAL_TO_ARRAY = new byte [] {'<', '='};
166  public static final ByteBuffer LESS_THAN_OR_EQUAL_TO_BUFFER =
167    ByteBuffer.wrap(LESS_THAN_OR_EQUAL_TO_ARRAY);
168
169  /**
170   * GREATER_THAN Array
171   */
172  public static final byte [] GREATER_THAN_ARRAY = new byte [] {'>'};
173  public static final ByteBuffer GREATER_THAN_BUFFER = ByteBuffer.wrap(GREATER_THAN_ARRAY);
174
175  /**
176   * GREATER_THAN_OR_EQUAL_TO Array
177   */
178  public static final byte [] GREATER_THAN_OR_EQUAL_TO_ARRAY = new byte [] {'>', '='};
179  public static final ByteBuffer GREATER_THAN_OR_EQUAL_TO_BUFFER =
180    ByteBuffer.wrap(GREATER_THAN_OR_EQUAL_TO_ARRAY);
181
182  /**
183   * EQUAL_TO Array
184   */
185  public static final byte [] EQUAL_TO_ARRAY = new byte [] {'='};
186  public static final ByteBuffer EQUAL_TO_BUFFER = ByteBuffer.wrap(EQUAL_TO_ARRAY);
187
188  /**
189   * NOT_EQUAL_TO Array
190   */
191  public static final byte [] NOT_EQUAL_TO_ARRAY = new byte [] {'!', '='};
192  public static final ByteBuffer NOT_EQUAL_TO_BUFFER = ByteBuffer.wrap(NOT_EQUAL_TO_ARRAY);
193
194  /**
195   * ASCII code for equal to (=)
196   */
197  public static final int EQUAL_TO = '=';
198
199  /**
200   * AND Byte Array
201   */
202  public static final byte [] AND = new byte [] {'A','N','D'};
203
204  /**
205   * OR Byte Array
206   */
207  public static final byte [] OR = new byte [] {'O', 'R'};
208
209  /**
210   * LPAREN Array
211   */
212  public static final byte [] LPAREN_ARRAY = new byte [] {'('};
213  public static final ByteBuffer LPAREN_BUFFER = ByteBuffer.wrap(LPAREN_ARRAY);
214
215  /**
216   * ASCII code for colon (:)
217   */
218  public static final int COLON = ':';
219
220  /**
221   * ASCII code for Zero
222   */
223  public static final int ZERO = '0';
224
225  /**
226   * ASCII code foe Nine
227   */
228  public static final int NINE = '9';
229
230  /**
231   * BinaryType byte array
232   */
233  public static final byte [] binaryType = new byte [] {'b','i','n','a','r','y'};
234
235  /**
236   * BinaryPrefixType byte array
237   */
238  public static final byte [] binaryPrefixType = new byte [] {'b','i','n','a','r','y',
239                                                              'p','r','e','f','i','x'};
240
241  /**
242   * RegexStringType byte array
243   */
244  public static final byte [] regexStringType = new byte [] {'r','e','g','e', 'x',
245                                                             's','t','r','i','n','g'};
246
247  /**
248   * SubstringType byte array
249   */
250  public static final byte [] substringType = new byte [] {'s','u','b','s','t','r','i','n','g'};
251
252  /**
253   * ASCII for Minus Sign
254   */
255  public static final int MINUS_SIGN = '-';
256
257  /**
258   * Package containing filters
259   */
260  public static final String FILTER_PACKAGE = "org.apache.hadoop.hbase.filter";
261}