home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / text / UnicodeClassMapping.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  943 b   |  46 lines

  1. package java.text;
  2.  
  3. final class UnicodeClassMapping {
  4.    private int[] mappedValue;
  5.    private SpecialMapping[] exceptionChars;
  6.    private boolean[] hasException;
  7.    private int[] asciiValues;
  8.  
  9.    public UnicodeClassMapping(int[] var1, SpecialMapping[] var2, boolean[] var3, int[] var4) {
  10.       this.mappedValue = var1;
  11.       this.exceptionChars = var2;
  12.       this.hasException = var3;
  13.       this.asciiValues = var4;
  14.    }
  15.  
  16.    public int mappedChar(char var1) {
  17.       if (var1 <= 255) {
  18.          return this.asciiValues[var1];
  19.       } else {
  20.          int var2 = Character.getType(var1);
  21.          if (this.exceptionChars.length != 0 && (this.hasException[var2] || var1 == '\uffff')) {
  22.             int var3 = 0;
  23.             int var4 = this.exceptionChars.length - 1;
  24.  
  25.             while(var4 > var3) {
  26.                int var5 = var4 + var3 >> 1;
  27.                if (var1 > this.exceptionChars[var5].endChar) {
  28.                   var3 = var5 + 1;
  29.                } else {
  30.                   var4 = var5;
  31.                }
  32.             }
  33.  
  34.             SpecialMapping var6 = this.exceptionChars[var3];
  35.             if (var6.startChar <= var1 && var1 <= var6.endChar) {
  36.                return var6.newValue;
  37.             } else {
  38.                return this.mappedValue[var2];
  39.             }
  40.          } else {
  41.             return this.mappedValue[var2];
  42.          }
  43.       }
  44.    }
  45. }
  46.