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 / util / SubList.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.9 KB  |  153 lines

  1. package java.util;
  2.  
  3. class SubList extends AbstractList {
  4.    // $FF: renamed from: l java.util.AbstractList
  5.    private AbstractList field_0;
  6.    private int offset;
  7.    private int size;
  8.    private int expectedModCount;
  9.  
  10.    SubList(AbstractList var1, int var2, int var3) {
  11.       if (var2 < 0) {
  12.          throw new IndexOutOfBoundsException("fromIndex = " + var2);
  13.       } else if (var3 > ((AbstractCollection)var1).size()) {
  14.          throw new IndexOutOfBoundsException("toIndex = " + var3);
  15.       } else if (var2 > var3) {
  16.          throw new IllegalArgumentException("fromIndex(" + var2 + ") > toIndex(" + var3 + ")");
  17.       } else {
  18.          this.field_0 = var1;
  19.          this.offset = var2;
  20.          this.size = var3 - var2;
  21.          this.expectedModCount = this.field_0.modCount;
  22.       }
  23.    }
  24.  
  25.    public Object set(int var1, Object var2) {
  26.       this.rangeCheck(var1);
  27.       this.checkForComodification();
  28.       return this.field_0.set(var1 + this.offset, var2);
  29.    }
  30.  
  31.    public Object get(int var1) {
  32.       this.rangeCheck(var1);
  33.       this.checkForComodification();
  34.       return this.field_0.get(var1 + this.offset);
  35.    }
  36.  
  37.    public int size() {
  38.       this.checkForComodification();
  39.       return this.size;
  40.    }
  41.  
  42.    public void add(int var1, Object var2) {
  43.       if (var1 >= 0 && var1 <= this.size) {
  44.          this.checkForComodification();
  45.          this.field_0.add(var1 + this.offset, var2);
  46.          this.expectedModCount = this.field_0.modCount;
  47.          ++this.size;
  48.          ++super.modCount;
  49.       } else {
  50.          throw new IndexOutOfBoundsException();
  51.       }
  52.    }
  53.  
  54.    public Object remove(int var1) {
  55.       this.rangeCheck(var1);
  56.       this.checkForComodification();
  57.       Object var2 = this.field_0.remove(var1 + this.offset);
  58.       this.expectedModCount = this.field_0.modCount;
  59.       --this.size;
  60.       ++super.modCount;
  61.       return var2;
  62.    }
  63.  
  64.    protected void removeRange(int var1, int var2) {
  65.       this.checkForComodification();
  66.       this.field_0.removeRange(var1 + this.offset, var2 + this.offset);
  67.       this.expectedModCount = this.field_0.modCount;
  68.       this.size -= var2 - var1;
  69.       ++super.modCount;
  70.    }
  71.  
  72.    public boolean addAll(Collection var1) {
  73.       return this.addAll(this.size, var1);
  74.    }
  75.  
  76.    public boolean addAll(int var1, Collection var2) {
  77.       if (var1 >= 0 && var1 <= this.size) {
  78.          int var3 = var2.size();
  79.          if (var3 == 0) {
  80.             return false;
  81.          } else {
  82.             this.checkForComodification();
  83.             this.field_0.addAll(this.offset + var1, var2);
  84.             this.expectedModCount = this.field_0.modCount;
  85.             this.size += var3;
  86.             ++super.modCount;
  87.             return true;
  88.          }
  89.       } else {
  90.          throw new IndexOutOfBoundsException("Index: " + var1 + ", Size: " + this.size);
  91.       }
  92.    }
  93.  
  94.    public Iterator iterator() {
  95.       return ((AbstractList)this).listIterator();
  96.    }
  97.  
  98.    public ListIterator listIterator(int var1) {
  99.       this.checkForComodification();
  100.       if (var1 >= 0 && var1 <= this.size) {
  101.          return new 1(this, var1);
  102.       } else {
  103.          throw new IndexOutOfBoundsException("Index: " + var1 + ", Size: " + this.size);
  104.       }
  105.    }
  106.  
  107.    public List subList(int var1, int var2) {
  108.       return new SubList(this, var1, var2);
  109.    }
  110.  
  111.    private void rangeCheck(int var1) {
  112.       if (var1 < 0 || var1 >= this.size) {
  113.          throw new IndexOutOfBoundsException("Index: " + var1 + ",Size: " + this.size);
  114.       }
  115.    }
  116.  
  117.    private void checkForComodification() {
  118.       if (this.field_0.modCount != this.expectedModCount) {
  119.          throw new ConcurrentModificationException();
  120.       }
  121.    }
  122.  
  123.    // $FF: synthetic method
  124.    static int access$000(SubList var0) {
  125.       return var0.offset;
  126.    }
  127.  
  128.    // $FF: synthetic method
  129.    static AbstractList access$100(SubList var0) {
  130.       return var0.field_0;
  131.    }
  132.  
  133.    // $FF: synthetic method
  134.    static int access$200(SubList var0) {
  135.       return var0.size;
  136.    }
  137.  
  138.    // $FF: synthetic method
  139.    static int access$302(SubList var0, int var1) {
  140.       return var0.expectedModCount = var1;
  141.    }
  142.  
  143.    // $FF: synthetic method
  144.    static int access$210(SubList var0) {
  145.       return var0.size--;
  146.    }
  147.  
  148.    // $FF: synthetic method
  149.    static int access$208(SubList var0) {
  150.       return var0.size++;
  151.    }
  152. }
  153.