1 Clazz.declarePackage ("java.awt");
2 Clazz.load (["java.awt.geom.Dimension2D"], "java.awt.Dimension", null, function () {
3 c$ = Clazz.decorateAsClass (function () {
6 Clazz.instantialize (this, arguments);
7 }, java.awt, "Dimension", java.awt.geom.Dimension2D);
8 Clazz.makeConstructor (c$,
10 this.construct (0, 0);
12 Clazz.makeConstructor (c$,
14 this.construct (d.width, d.height);
15 }, "java.awt.Dimension");
16 Clazz.makeConstructor (c$,
17 function (width, height) {
18 Clazz.superConstructor (this, java.awt.Dimension, []);
22 Clazz.overrideMethod (c$, "getWidth",
26 Clazz.overrideMethod (c$, "getHeight",
30 Clazz.defineMethod (c$, "setSize",
31 function (width, height) {
32 this.width = Clazz.doubleToInt (Math.ceil (width));
33 this.height = Clazz.doubleToInt (Math.ceil (height));
35 Clazz.defineMethod (c$, "getSize",
37 return new java.awt.Dimension (this.width, this.height);
39 Clazz.defineMethod (c$, "setSize",
41 this.setSize (d.width, d.height);
42 }, "java.awt.Dimension");
43 Clazz.defineMethod (c$, "setSize",
44 function (width, height) {
48 Clazz.overrideMethod (c$, "equals",
50 if (Clazz.instanceOf (obj, java.awt.Dimension)) {
52 return (this.width == d.width) && (this.height == d.height);
55 Clazz.overrideMethod (c$, "hashCode",
57 var sum = this.width + this.height;
58 return Clazz.doubleToInt (sum * (sum + 1) / 2) + this.width;
60 Clazz.overrideMethod (c$, "toString",
62 return this.getClass ().getName () + "[width=" + this.width + ",height=" + this.height + "]";