@@ -0,0 +1,2919 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.core.parsing.antlr.extractor.statement.util;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport io.shardingsphere.core.parsing.lexer.token.DefaultKeyword;%0Aimport io.shardingsphere.core.parsing.lexer.token.Symbol;%0A%0A/**%0A * Condition utility.%0A * %0A * @author duhongjun%0A */%0Apublic class OperatorUtils %7B%0A    %0A    private static final Map%3CString, String%3E parens = new HashMap%3C%3E();%0A    static %7B%0A        parens.put(%22(%22, %22)%22);%0A        parens.put(%22%5B%22, %22%5D%22);%0A        parens.put(%22%7B%22, %22%7D%22);%0A    %7D%0A    %0A    /**%0A     * Judge is rational operator.%0A     * %0A     * @param text input text%0A     * @return rational operator return true%0A     */%0A    public static boolean isRationalOperator(String text) %7B%0A        if (isAnd(text)) %7B%0A            return true;%0A        %7D%0A        if (isOr(text)) %7B%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A    %0A    /**%0A     * Is keyword or operator.%0A     * %0A     * @param text input text%0A     * @return or operator return true%0A     */%0A    public static boolean isOr(String text) %7B%0A        if (DefaultKeyword.OR.name().equalsIgnoreCase(text)) %7B%0A            return true;%0A        %7D%0A        if (Symbol.DOUBLE_BAR.name().equalsIgnoreCase(text)) %7B%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A    %0A    /**%0A     * Is keyword and operator.%0A     * %0A     * @param text input text%0A     * @return and operator return true%0A     */%0A    public static boolean isAnd(String text) %7B%0A        if (DefaultKeyword.AND.name().equalsIgnoreCase(text)) %7B%0A            return true;%0A        %7D%0A        if (Symbol.DOUBLE_AMP.name().equalsIgnoreCase(text)) %7B%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A    %0A    /**%0A     * Is start paren ex '(','%5B', '%7B'.%0A     * %0A     * @param text input text%0A     * @return start paren return true%0A     */%0A    public static boolean isStartParen(String text) %7B%0A        return parens.containsKey(text);%0A    %7D%0A    %0A    /**%0A     * Judge start paren match end paren.%0A     * %0A     * @param startParen start paren%0A     * @param endParen end paren%0A     * @return match return true%0A     */%0A    public static boolean parenMatch(String startParen, String endParen) %7B%0A        if(parens.containsKey(startParen)) %7B%0A            return parens.get(startParen).equals(endParen);%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

add OperatorUtils