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 / awt / geom / LineIterator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.1 KB  |  73 lines

  1. package java.awt.geom;
  2.  
  3. import java.util.NoSuchElementException;
  4.  
  5. class LineIterator implements PathIterator {
  6.    Line2D line;
  7.    AffineTransform affine;
  8.    int index;
  9.  
  10.    LineIterator(Line2D var1, AffineTransform var2) {
  11.       this.line = var1;
  12.       this.affine = var2;
  13.    }
  14.  
  15.    public int getWindingRule() {
  16.       return 1;
  17.    }
  18.  
  19.    public boolean isDone() {
  20.       return this.index > 1;
  21.    }
  22.  
  23.    public void next() {
  24.       ++this.index;
  25.    }
  26.  
  27.    public int currentSegment(float[] var1) {
  28.       if (this.isDone()) {
  29.          throw new NoSuchElementException("line iterator out of bounds");
  30.       } else {
  31.          byte var2;
  32.          if (this.index == 0) {
  33.             var1[0] = (float)this.line.getX1();
  34.             var1[1] = (float)this.line.getY1();
  35.             var2 = 0;
  36.          } else {
  37.             var1[0] = (float)this.line.getX2();
  38.             var1[1] = (float)this.line.getY2();
  39.             var2 = 1;
  40.          }
  41.  
  42.          if (this.affine != null) {
  43.             this.affine.transform(var1, 0, var1, 0, 1);
  44.          }
  45.  
  46.          return var2;
  47.       }
  48.    }
  49.  
  50.    public int currentSegment(double[] var1) {
  51.       if (this.isDone()) {
  52.          throw new NoSuchElementException("line iterator out of bounds");
  53.       } else {
  54.          byte var2;
  55.          if (this.index == 0) {
  56.             var1[0] = this.line.getX1();
  57.             var1[1] = this.line.getY1();
  58.             var2 = 0;
  59.          } else {
  60.             var1[0] = this.line.getX2();
  61.             var1[1] = this.line.getY2();
  62.             var2 = 1;
  63.          }
  64.  
  65.          if (this.affine != null) {
  66.             this.affine.transform(var1, 0, var1, 0, 1);
  67.          }
  68.  
  69.          return var2;
  70.       }
  71.    }
  72. }
  73.