src/java.base/share/classes/java/util/regex/EmojiData.java.template
author redestad
Sat, 01 Jun 2019 03:18:23 +0200
changeset 55141 db105c4c5776
parent 55013 8dae495a59e7
permissions -rw-r--r--
8225061: Performance regression in Regex Reviewed-by: naoto, alanb Contributed-by: claes.redestad@oracle.com, naoto.sato@oracle.com

/*
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

package java.util.regex;

/**
 * Holds data contained in the Unicode Technical Standard #51: Unicode
 * Emoji. 
 * 
 * Currently it is only used for the rule "GB11" in UAX #29 Unicode Text
 * Segmentation.
 */
final class EmojiData {
    /**
     * Returns whether the code point is an extended pictographic or not.
     *
     * @param cp code point to examine
     * @return true if {@code cp} is an extended pictographic
     */
    static boolean isExtendedPictographic(int cp) {
        if (cp < 0x2000) {
            return
%%%EXTPICT_LOW%%%
        } else {
            return isHigh(cp);
        }
    }

    private static boolean isHigh(int cp) {
        return
%%%EXTPICT_HIGH%%%
    }
}