Esempio n. 1
0
 // Create a new state representing this state, but an additional character
 // output in Binary Shift mode.
 State addBinaryShiftChar(int index) {
   Token token = this.token;
   int mode = this.mode;
   int bitCount = this.bitCount;
   if (this.mode == HighLevelEncoder.MODE_PUNCT || this.mode == HighLevelEncoder.MODE_DIGIT) {
     // assert binaryShiftByteCount == 0;
     int latch = HighLevelEncoder.LATCH_TABLE[mode][HighLevelEncoder.MODE_UPPER];
     token = token.add(latch & 0xFFFF, latch >> 16);
     bitCount += latch >> 16;
     mode = HighLevelEncoder.MODE_UPPER;
   }
   int deltaBitCount =
       (binaryShiftByteCount == 0 || binaryShiftByteCount == 31)
           ? 18
           : (binaryShiftByteCount == 62) ? 9 : 8;
   State result = new State(token, mode, binaryShiftByteCount + 1, bitCount + deltaBitCount);
   if (result.binaryShiftByteCount == 2047 + 31) {
     // The string is as long as it's allowed to be.  We should end it.
     result = result.endBinaryShift(index + 1);
   }
   return result;
 }
Esempio n. 2
0
 final State addBinaryShiftChar(int i) {
   Object obj;
   int k;
   int l;
   label0:
   {
     Token token1 = token;
     int i1 = mode;
     int j = bitCount;
     if (mode != 4) {
       l = j;
       k = i1;
       obj = token1;
       if (mode != 2) {
         break label0;
       }
     }
     k = HighLevelEncoder.LATCH_TABLE[i1][0];
     obj = token1.add(0xffff & k, k >> 16);
     l = j + (k >> 16);
     k = 0;
   }
   State state;
   byte byte0;
   if (binaryShiftByteCount == 0 || binaryShiftByteCount == 31) {
     byte0 = 18;
   } else if (binaryShiftByteCount == 62) {
     byte0 = 9;
   } else {
     byte0 = 8;
   }
   state = new State(((Token) (obj)), k, binaryShiftByteCount + 1, l + byte0);
   obj = state;
   if (state.binaryShiftByteCount == 2078) {
     obj = state.endBinaryShift(i + 1);
   }
   return ((State) (obj));
 }