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 / CubicIterator.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.3 KB  |  81 lines

  1. package java.awt.geom;
  2.  
  3. import java.util.NoSuchElementException;
  4.  
  5. class CubicIterator implements PathIterator {
  6.    CubicCurve2D cubic;
  7.    AffineTransform affine;
  8.    int index;
  9.  
  10.    CubicIterator(CubicCurve2D var1, AffineTransform var2) {
  11.       this.cubic = 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("cubic iterator iterator out of bounds");
  30.       } else {
  31.          byte var2;
  32.          if (this.index == 0) {
  33.             var1[0] = (float)this.cubic.getX1();
  34.             var1[1] = (float)this.cubic.getY1();
  35.             var2 = 0;
  36.          } else {
  37.             var1[0] = (float)this.cubic.getCtrlX1();
  38.             var1[1] = (float)this.cubic.getCtrlY1();
  39.             var1[2] = (float)this.cubic.getCtrlX2();
  40.             var1[3] = (float)this.cubic.getCtrlY2();
  41.             var1[4] = (float)this.cubic.getX2();
  42.             var1[5] = (float)this.cubic.getY2();
  43.             var2 = 3;
  44.          }
  45.  
  46.          if (this.affine != null) {
  47.             this.affine.transform(var1, 0, var1, 0, this.index == 0 ? 1 : 3);
  48.          }
  49.  
  50.          return var2;
  51.       }
  52.    }
  53.  
  54.    public int currentSegment(double[] var1) {
  55.       if (this.isDone()) {
  56.          throw new NoSuchElementException("cubic iterator iterator out of bounds");
  57.       } else {
  58.          byte var2;
  59.          if (this.index == 0) {
  60.             var1[0] = this.cubic.getX1();
  61.             var1[1] = this.cubic.getY1();
  62.             var2 = 0;
  63.          } else {
  64.             var1[0] = this.cubic.getCtrlX1();
  65.             var1[1] = this.cubic.getCtrlY1();
  66.             var1[2] = this.cubic.getCtrlX2();
  67.             var1[3] = this.cubic.getCtrlY2();
  68.             var1[4] = this.cubic.getX2();
  69.             var1[5] = this.cubic.getY2();
  70.             var2 = 3;
  71.          }
  72.  
  73.          if (this.affine != null) {
  74.             this.affine.transform(var1, 0, var1, 0, this.index == 0 ? 1 : 3);
  75.          }
  76.  
  77.          return var2;
  78.       }
  79.    }
  80. }
  81.