@ Override public final int get ( int codePoint ) { int value ; int ix ; if ( codePoint >= 0 ) { if ( codePoint < 0x0d800 || ( codePoint > 0x0dbff && codePoint <= 0x0ffff ) ) { // Ordinary BMP code point, excluding leading surrogates. // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index. // 32 bit data is stored in the index array itself. ix = index [ codePoint >> UTRIE2_SHIFT_2 ] ; ix = ( ix << UTRIE2_INDEX_SHIFT ) + ( codePoint & UTRIE2_DATA_MASK ) ; value = data32 [ ix ] ; return value ; } if ( codePoint <= 0xffff ) { // Lead Surrogate Code Point. A Separate index section is stored for // lead surrogate code units and code points. // The main index has the code unit data. // For this function, we need the code point data. // Note: this expression could be refactored for slightly improved efficiency, but // surrogate code points will be so rare in practice that it's not worth it. ix = index [ UTRIE2_LSCP_INDEX_2_OFFSET + ( ( codePoint - 0xd800 ) >> UTRIE2_SHIFT_2 ) ] ; ix = ( ix << UTRIE2_INDEX_SHIFT ) + ( codePoint & UTRIE2_DATA_MASK ) ; value = data32 [ ix ] ; return value ; } if ( codePoint < highStart ) { // Supplemental code point, use two-level lookup. ix = ( UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH ) + ( codePoint >> UTRIE2_SHIFT_1 ) ; ix = index [ ix ] ; ix += ( codePoint >> UTRIE2_SHIFT_2 ) & UTRIE2_INDEX_2_MASK ; ix = index [ ix ] ; ix = ( ix << UTRIE2_INDEX_SHIFT ) + ( codePoint & UTRIE2_DATA_MASK ) ; value = data32 [ ix ] ; return value ; } if ( codePoint <= 0x10ffff ) { value = data32 [ highValueIndex ] ; return value ; } } // Fall through. The code point is outside of the legal range of 0..0x10ffff. return errorValue ; }
Get the value for a code point as stored in the Trie2 .