Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / geom / Point2D.js
1 Clazz.declarePackage ("java.awt.geom");
2 Clazz.load (null, "java.awt.geom.Point2D", ["java.lang.Double", "$.InternalError"], function () {
3 c$ = Clazz.declareType (java.awt.geom, "Point2D", null, Cloneable);
4 Clazz.makeConstructor (c$, 
5 function () {
6 });
7 Clazz.defineMethod (c$, "setLocation", 
8 function (p) {
9 this.setLocation (p.getX (), p.getY ());
10 }, "java.awt.geom.Point2D");
11 c$.distanceSq = Clazz.defineMethod (c$, "distanceSq", 
12 function (x1, y1, x2, y2) {
13 x1 -= x2;
14 y1 -= y2;
15 return (x1 * x1 + y1 * y1);
16 }, "~N,~N,~N,~N");
17 c$.distance = Clazz.defineMethod (c$, "distance", 
18 function (x1, y1, x2, y2) {
19 x1 -= x2;
20 y1 -= y2;
21 return Math.sqrt (x1 * x1 + y1 * y1);
22 }, "~N,~N,~N,~N");
23 Clazz.defineMethod (c$, "distanceSq", 
24 function (px, py) {
25 px -= this.getX ();
26 py -= this.getY ();
27 return (px * px + py * py);
28 }, "~N,~N");
29 Clazz.defineMethod (c$, "distanceSq", 
30 function (pt) {
31 var px = pt.getX () - this.getX ();
32 var py = pt.getY () - this.getY ();
33 return (px * px + py * py);
34 }, "java.awt.geom.Point2D");
35 Clazz.defineMethod (c$, "distance", 
36 function (px, py) {
37 px -= this.getX ();
38 py -= this.getY ();
39 return Math.sqrt (px * px + py * py);
40 }, "~N,~N");
41 Clazz.defineMethod (c$, "distance", 
42 function (pt) {
43 var px = pt.getX () - this.getX ();
44 var py = pt.getY () - this.getY ();
45 return Math.sqrt (px * px + py * py);
46 }, "java.awt.geom.Point2D");
47 Clazz.defineMethod (c$, "clone", 
48 function () {
49 try {
50 return Clazz.superCall (this, java.awt.geom.Point2D, "clone", []);
51 } catch (e) {
52 if (Clazz.exceptionOf (e, CloneNotSupportedException)) {
53 throw  new InternalError ();
54 } else {
55 throw e;
56 }
57 }
58 });
59 Clazz.overrideMethod (c$, "hashCode", 
60 function () {
61 var bits = java.lang.Double.doubleToLongBits (this.getX ());
62 bits ^= java.lang.Double.doubleToLongBits (this.getY ()) * 31;
63 return ((bits) ^ ((bits >> 32)));
64 });
65 Clazz.defineMethod (c$, "equals", 
66 function (obj) {
67 if (Clazz.instanceOf (obj, java.awt.geom.Point2D)) {
68 var p2d = obj;
69 return (this.getX () == p2d.getX ()) && (this.getY () == p2d.getY ());
70 }return Clazz.superCall (this, java.awt.geom.Point2D, "equals", [obj]);
71 }, "~O");
72 Clazz.pu$h(self.c$);
73 c$ = Clazz.decorateAsClass (function () {
74 this.x = 0;
75 this.y = 0;
76 Clazz.instantialize (this, arguments);
77 }, java.awt.geom.Point2D, "Float", java.awt.geom.Point2D);
78 Clazz.makeConstructor (c$, 
79 function () {
80 Clazz.superConstructor (this, java.awt.geom.Point2D.Float, []);
81 });
82 Clazz.makeConstructor (c$, 
83 function (a, b) {
84 Clazz.superConstructor (this, java.awt.geom.Point2D.Float, []);
85 this.x = a;
86 this.y = b;
87 }, "~N,~N");
88 Clazz.overrideMethod (c$, "getX", 
89 function () {
90 return this.x;
91 });
92 Clazz.overrideMethod (c$, "getY", 
93 function () {
94 return this.y;
95 });
96 Clazz.defineMethod (c$, "setLocation", 
97 function (a, b) {
98 this.x = a;
99 this.y = b;
100 }, "~N,~N");
101 Clazz.defineMethod (c$, "setLocation", 
102 function (a, b) {
103 this.x = a;
104 this.y = b;
105 }, "~N,~N");
106 Clazz.overrideMethod (c$, "toString", 
107 function () {
108 return "Point2D.Float[" + this.x + ", " + this.y + "]";
109 });
110 c$ = Clazz.p0p ();
111 Clazz.pu$h(self.c$);
112 c$ = Clazz.decorateAsClass (function () {
113 this.x = 0;
114 this.y = 0;
115 Clazz.instantialize (this, arguments);
116 }, java.awt.geom.Point2D, "Double", java.awt.geom.Point2D);
117 Clazz.makeConstructor (c$, 
118 function () {
119 Clazz.superConstructor (this, java.awt.geom.Point2D.Double, []);
120 });
121 Clazz.makeConstructor (c$, 
122 function (a, b) {
123 Clazz.superConstructor (this, java.awt.geom.Point2D.Double, []);
124 this.x = a;
125 this.y = b;
126 }, "~N,~N");
127 Clazz.overrideMethod (c$, "getX", 
128 function () {
129 return this.x;
130 });
131 Clazz.overrideMethod (c$, "getY", 
132 function () {
133 return this.y;
134 });
135 Clazz.defineMethod (c$, "setLocation", 
136 function (a, b) {
137 this.x = a;
138 this.y = b;
139 }, "~N,~N");
140 Clazz.overrideMethod (c$, "toString", 
141 function () {
142 return "Point2D.Double[" + this.x + ", " + this.y + "]";
143 });
144 c$ = Clazz.p0p ();
145 });