< prev index next >

make/data/characterdata/CharacterData02.java.template

Print this page


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


 198     int getNumericValue(int ch) {
 199         int val = getProperties(ch);
 200         int retval = -1;
 201 
 202         switch (val & $$maskNumericType) {
 203         default: // cannot occur
 204         case ($$valueNotNumeric):         // not numeric
 205             retval = -1;
 206             break;
 207         case ($$valueDigit):              // simple numeric
 208             retval = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
 209             break;
 210         case ($$valueStrangeNumeric)      :       // "strange" numeric
 211             retval = -2;
 212             break;
 213         case ($$valueJavaSupradecimal):           // Java supradecimal
 214             retval = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
 215             break;
 216         }
 217         return retval;
 218     }
 219 
 220     boolean isDigit(int ch) {
 221         int props = getProperties(ch);
 222         return (props & $$maskType) == Character.DECIMAL_DIGIT_NUMBER;
 223     }
 224 
 225     boolean isLowerCase(int ch) {
 226         int props = getProperties(ch);
 227         return (props & $$maskType) == Character.LOWERCASE_LETTER;
 228     }
 229 
 230     boolean isUpperCase(int ch) {
 231         int props = getProperties(ch);
 232         return (props & $$maskType) == Character.UPPERCASE_LETTER;
 233     }
 234 
 235     boolean isWhitespace(int ch) {
 236         return (getProperties(ch) & $$maskIdentifierInfo) == $$valueJavaWhitespace;
 237     }
 238 
 239     byte getDirectionality(int ch) {
 240         int val = getProperties(ch);
 241         byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi);
 242         if (directionality == 0xF ) {
 243                 directionality = Character.DIRECTIONALITY_UNDEFINED;
 244         }
 245         return directionality;
 246     }
 247 
 248     boolean isMirrored(int ch) {
 249         return (getProperties(ch) & $$maskMirrored) != 0;
 250     }
 251 
 252     static final CharacterData instance = new CharacterData02();
   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 198     int getNumericValue(int ch) {
 199         int val = getProperties(ch);
 200         int retval = -1;
 201 
 202         switch (val & $$maskNumericType) {
 203         default: // cannot occur
 204         case ($$valueNotNumeric):         // not numeric
 205             retval = -1;
 206             break;
 207         case ($$valueDigit):              // simple numeric
 208             retval = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
 209             break;
 210         case ($$valueStrangeNumeric)      :       // "strange" numeric
 211             retval = -2;
 212             break;
 213         case ($$valueJavaSupradecimal):           // Java supradecimal
 214             retval = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
 215             break;
 216         }
 217         return retval;















 218     }
 219 
 220     boolean isWhitespace(int ch) {
 221         return (getProperties(ch) & $$maskIdentifierInfo) == $$valueJavaWhitespace;
 222     }
 223 
 224     byte getDirectionality(int ch) {
 225         int val = getProperties(ch);
 226         byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi);
 227         if (directionality == 0xF ) {
 228                 directionality = Character.DIRECTIONALITY_UNDEFINED;
 229         }
 230         return directionality;
 231     }
 232 
 233     boolean isMirrored(int ch) {
 234         return (getProperties(ch) & $$maskMirrored) != 0;
 235     }
 236 
 237     static final CharacterData instance = new CharacterData02();
< prev index next >