< prev index next >

make/data/characterdata/CharacterData0E.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         int props = getProperties(ch);
 237         return ((props & $$maskIdentifierInfo) == $$valueJavaWhitespace);
 238     }
 239 
 240     byte getDirectionality(int ch) {
 241         int val = getProperties(ch);
 242         byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi);
 243         if (directionality == 0xF ) {
 244                 directionality = Character.DIRECTIONALITY_UNDEFINED;
 245         }
 246         return directionality;
 247     }
 248 
 249     boolean isMirrored(int ch) {
 250         int props = getProperties(ch);
 251         return ((props & $$maskMirrored) != 0);
 252     }
   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         int props = getProperties(ch);
 222         return ((props & $$maskIdentifierInfo) == $$valueJavaWhitespace);
 223     }
 224 
 225     byte getDirectionality(int ch) {
 226         int val = getProperties(ch);
 227         byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi);
 228         if (directionality == 0xF ) {
 229                 directionality = Character.DIRECTIONALITY_UNDEFINED;
 230         }
 231         return directionality;
 232     }
 233 
 234     boolean isMirrored(int ch) {
 235         int props = getProperties(ch);
 236         return ((props & $$maskMirrored) != 0);
 237     }
< prev index next >