Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / geom / RectIterator.js
1 Clazz.declarePackage ("java.awt.geom");
2 Clazz.load (["java.awt.geom.PathIterator"], "java.awt.geom.RectIterator", ["java.util.NoSuchElementException"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.x = 0;
5 this.y = 0;
6 this.w = 0;
7 this.h = 0;
8 this.affine = null;
9 this.index = 0;
10 Clazz.instantialize (this, arguments);
11 }, java.awt.geom, "RectIterator", null, java.awt.geom.PathIterator);
12 Clazz.makeConstructor (c$, 
13 function (r, at) {
14 this.x = r.getX ();
15 this.y = r.getY ();
16 this.w = r.getWidth ();
17 this.h = r.getHeight ();
18 this.affine = at;
19 if (this.w < 0 || this.h < 0) {
20 this.index = 6;
21 }}, "java.awt.geom.Rectangle2D,java.awt.geom.AffineTransform");
22 Clazz.overrideMethod (c$, "getWindingRule", 
23 function () {
24 return 1;
25 });
26 Clazz.overrideMethod (c$, "isDone", 
27 function () {
28 return this.index > 5;
29 });
30 Clazz.overrideMethod (c$, "next", 
31 function () {
32 this.index++;
33 });
34 Clazz.defineMethod (c$, "currentSegment", 
35 function (coords) {
36 if (this.isDone ()) {
37 throw  new java.util.NoSuchElementException ("rect iterator out of bounds");
38 }if (this.index == 5) {
39 return 4;
40 }coords[0] = this.x;
41 coords[1] = this.y;
42 if (this.index == 1 || this.index == 2) {
43 coords[0] += this.w;
44 }if (this.index == 2 || this.index == 3) {
45 coords[1] += this.h;
46 }if (this.affine != null) {
47 this.affine.transform (coords, 0, coords, 0, 1);
48 }return (this.index == 0 ? 0 : 1);
49 }, "~A");
50 Clazz.defineMethod (c$, "currentSegment", 
51 function (coords) {
52 if (this.isDone ()) {
53 throw  new java.util.NoSuchElementException ("rect iterator out of bounds");
54 }if (this.index == 5) {
55 return 4;
56 }coords[0] = this.x;
57 coords[1] = this.y;
58 if (this.index == 1 || this.index == 2) {
59 coords[0] += this.w;
60 }if (this.index == 2 || this.index == 3) {
61 coords[1] += this.h;
62 }if (this.affine != null) {
63 this.affine.transform (coords, 0, coords, 0, 1);
64 }return (this.index == 0 ? 0 : 1);
65 }, "~A");
66 });