home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / text / CompactShortArray$Iterator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.1 KB  |  70 lines

  1. package java.text;
  2.  
  3. class CompactShortArray$Iterator {
  4.    int nextIndex;
  5.    int index;
  6.    short nextValue;
  7.    short value;
  8.    short iUntouched;
  9.    boolean touched;
  10.    short defValue;
  11.    // $FF: synthetic field
  12.    private final CompactShortArray this$0;
  13.  
  14.    CompactShortArray$Iterator(CompactShortArray var1) {
  15.       this.this$0 = var1;
  16.       this.nextIndex = -1;
  17.       this.index = -1;
  18.       this.iUntouched = -1;
  19.       this.touched = true;
  20.       this.defValue = this.this$0.defaultValue;
  21.       var1.compact();
  22.    }
  23.  
  24.    public boolean hasNext() {
  25.       this.nextIndex = this.index;
  26.       boolean var1 = true;
  27.       if (this.index != this.nextIndex) {
  28.          return true;
  29.       } else {
  30.          while(++this.nextIndex < 65535) {
  31.             if ((this.nextIndex & 127) == 0) {
  32.                int var2 = this.nextIndex >> 7;
  33.                if (CompactShortArray.access$000(this.this$0)[var2] == this.iUntouched) {
  34.                   this.nextIndex += 127;
  35.                   continue;
  36.                }
  37.  
  38.                if (this.iUntouched == -1 && !this.touched) {
  39.                   this.iUntouched = CompactShortArray.access$000(this.this$0)[var2 - 1];
  40.                } else {
  41.                   this.touched = false;
  42.                }
  43.             }
  44.  
  45.             this.nextValue = this.this$0.elementAt((char)this.nextIndex);
  46.             if (this.nextValue != this.defValue) {
  47.                this.touched = true;
  48.                break;
  49.             }
  50.          }
  51.  
  52.          return this.nextIndex < 65535;
  53.       }
  54.    }
  55.  
  56.    public char next() {
  57.       if (this.index == this.nextIndex && !this.hasNext()) {
  58.          throw new ArrayIndexOutOfBoundsException();
  59.       } else {
  60.          this.index = this.nextIndex;
  61.          this.value = this.nextValue;
  62.          return (char)this.index;
  63.       }
  64.    }
  65.  
  66.    public short shortValue() {
  67.       return this.value;
  68.    }
  69. }
  70.