home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Extras / OSpace / jgl.exe / jgl_2_0 / COM / objectspace / jgl / ArrayIterator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-03-12  |  1.8 KB  |  105 lines

  1. package COM.objectspace.jgl;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public final class ArrayIterator implements RandomAccessIterator, Serializable {
  6.    Array myArray;
  7.    int myIndex;
  8.  
  9.    public ArrayIterator() {
  10.    }
  11.  
  12.    public ArrayIterator(ArrayIterator var1) {
  13.       this.myArray = var1.myArray;
  14.       this.myIndex = var1.myIndex;
  15.    }
  16.  
  17.    public ArrayIterator(Array var1, int var2) {
  18.       this.myArray = var1;
  19.       this.myIndex = var2;
  20.    }
  21.  
  22.    public Object clone() {
  23.       return new ArrayIterator(this);
  24.    }
  25.  
  26.    public boolean equals(Object var1) {
  27.       if (var1 instanceof ArrayIterator) {
  28.          ArrayIterator var2 = (ArrayIterator)var1;
  29.          if (var2.myIndex == this.myIndex && (var2.myArray == this.myArray || false)) {
  30.             return true;
  31.          }
  32.       }
  33.  
  34.       return false;
  35.    }
  36.  
  37.    public boolean equals(ArrayIterator var1) {
  38.       return var1.myIndex == this.myIndex && var1.myArray == this.myArray;
  39.    }
  40.  
  41.    public boolean less(RandomAccessIterator var1) {
  42.       return this.myIndex < ((ArrayIterator)var1).myIndex;
  43.    }
  44.  
  45.    public Object get(int var1) {
  46.       return this.myArray.at(this.myIndex + var1);
  47.    }
  48.  
  49.    public void put(int var1, Object var2) {
  50.       this.myArray.put(this.myIndex + var1, var2);
  51.    }
  52.  
  53.    public boolean atBegin() {
  54.       return this.myIndex == 0;
  55.    }
  56.  
  57.    public boolean atEnd() {
  58.       return this.myIndex == this.myArray.size();
  59.    }
  60.  
  61.    public boolean hasMoreElements() {
  62.       return this.myIndex < this.myArray.size();
  63.    }
  64.  
  65.    public void advance() {
  66.       ++this.myIndex;
  67.    }
  68.  
  69.    public void advance(int var1) {
  70.       this.myIndex += var1;
  71.    }
  72.  
  73.    public void retreat() {
  74.       --this.myIndex;
  75.    }
  76.  
  77.    public void retreat(int var1) {
  78.       this.myIndex -= var1;
  79.    }
  80.  
  81.    public Object nextElement() {
  82.       return this.myArray.at(this.myIndex++);
  83.    }
  84.  
  85.    public Object get() {
  86.       return this.myArray.at(this.myIndex);
  87.    }
  88.  
  89.    public void put(Object var1) {
  90.       this.myArray.put(this.myIndex, var1);
  91.    }
  92.  
  93.    public int distance(ForwardIterator var1) {
  94.       return ((ArrayIterator)var1).myIndex - this.myIndex;
  95.    }
  96.  
  97.    public int index() {
  98.       return this.myIndex;
  99.    }
  100.  
  101.    public Container getContainer() {
  102.       return this.myArray;
  103.    }
  104. }
  105.