Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/lang/CharacterData.java
38829 views
/*1* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.lang;2627abstract class CharacterData {28abstract int getProperties(int ch);29abstract int getType(int ch);30abstract boolean isWhitespace(int ch);31abstract boolean isMirrored(int ch);32abstract boolean isJavaIdentifierStart(int ch);33abstract boolean isJavaIdentifierPart(int ch);34abstract boolean isUnicodeIdentifierStart(int ch);35abstract boolean isUnicodeIdentifierPart(int ch);36abstract boolean isIdentifierIgnorable(int ch);37abstract int toLowerCase(int ch);38abstract int toUpperCase(int ch);39abstract int toTitleCase(int ch);40abstract int digit(int ch, int radix);41abstract int getNumericValue(int ch);42abstract byte getDirectionality(int ch);4344//need to implement for JSR20445int toUpperCaseEx(int ch) {46return toUpperCase(ch);47}4849char[] toUpperCaseCharArray(int ch) {50return null;51}5253boolean isOtherLowercase(int ch) {54return false;55}5657boolean isOtherUppercase(int ch) {58return false;59}6061boolean isOtherAlphabetic(int ch) {62return false;63}6465boolean isIdeographic(int ch) {66return false;67}6869// Character <= 0xff (basic latin) is handled by internal fast-path70// to avoid initializing large tables.71// Note: performance of this "fast-path" code may be sub-optimal72// in negative cases for some accessors due to complicated ranges.73// Should revisit after optimization of table initialization.7475static final CharacterData of(int ch) {76if (ch >>> 8 == 0) { // fast-path77return CharacterDataLatin1.instance;78} else {79switch(ch >>> 16) { //plane 00-1680case(0):81return CharacterData00.instance;82case(1):83return CharacterData01.instance;84case(2):85return CharacterData02.instance;86case(14):87return CharacterData0E.instance;88case(15): // Private Use89case(16): // Private Use90return CharacterDataPrivateUse.instance;91default:92return CharacterDataUndefined.instance;93}94}95}96}979899