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