2c493bebfe5137349a55c095eea2b3f364e7a89e
[jalviewjs.git] / site / j2s / jssun / awt / geom / CurveLink.js
1 Clazz.declarePackage ("jssun.awt.geom");
2 Clazz.load (null, "jssun.awt.geom.CurveLink", ["java.lang.InternalError", "jssun.awt.geom.Order0"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.curve = null;
5 this.ytop = 0;
6 this.ybot = 0;
7 this.etag = 0;
8 this.next = null;
9 Clazz.instantialize (this, arguments);
10 }, jssun.awt.geom, "CurveLink");
11 Clazz.makeConstructor (c$, 
12 function (curve, ystart, yend, etag) {
13 this.curve = curve;
14 this.ytop = ystart;
15 this.ybot = yend;
16 this.etag = etag;
17 if (this.ytop < curve.getYTop () || this.ybot > curve.getYBot ()) {
18 throw  new InternalError ("bad curvelink [" + this.ytop + "=>" + this.ybot + "] for " + curve);
19 }}, "jssun.awt.geom.Curve,~N,~N,~N");
20 Clazz.defineMethod (c$, "absorb", 
21 function (link) {
22 return this.absorb (link.curve, link.ytop, link.ybot, link.etag);
23 }, "jssun.awt.geom.CurveLink");
24 Clazz.defineMethod (c$, "absorb", 
25 function (curve, ystart, yend, etag) {
26 if (this.curve !== curve || this.etag != etag || this.ybot < ystart || this.ytop > yend) {
27 return false;
28 }if (ystart < curve.getYTop () || yend > curve.getYBot ()) {
29 throw  new InternalError ("bad curvelink [" + ystart + "=>" + yend + "] for " + curve);
30 }this.ytop = Math.min (this.ytop, ystart);
31 this.ybot = Math.max (this.ybot, yend);
32 return true;
33 }, "jssun.awt.geom.Curve,~N,~N,~N");
34 Clazz.defineMethod (c$, "isEmpty", 
35 function () {
36 return (this.ytop == this.ybot);
37 });
38 Clazz.defineMethod (c$, "getCurve", 
39 function () {
40 return this.curve;
41 });
42 Clazz.defineMethod (c$, "getSubCurve", 
43 function () {
44 if (this.ytop == this.curve.getYTop () && this.ybot == this.curve.getYBot ()) {
45 return this.curve.getWithDirection (this.etag);
46 }return this.curve.getSubCurve (this.ytop, this.ybot, this.etag);
47 });
48 Clazz.defineMethod (c$, "getMoveto", 
49 function () {
50 return  new jssun.awt.geom.Order0 (this.getXTop (), this.getYTop ());
51 });
52 Clazz.defineMethod (c$, "getXTop", 
53 function () {
54 return this.curve.XforY (this.ytop);
55 });
56 Clazz.defineMethod (c$, "getYTop", 
57 function () {
58 return this.ytop;
59 });
60 Clazz.defineMethod (c$, "getXBot", 
61 function () {
62 return this.curve.XforY (this.ybot);
63 });
64 Clazz.defineMethod (c$, "getYBot", 
65 function () {
66 return this.ybot;
67 });
68 Clazz.defineMethod (c$, "getX", 
69 function () {
70 return this.curve.XforY (this.ytop);
71 });
72 Clazz.defineMethod (c$, "getEdgeTag", 
73 function () {
74 return this.etag;
75 });
76 Clazz.defineMethod (c$, "setNext", 
77 function (link) {
78 this.next = link;
79 }, "jssun.awt.geom.CurveLink");
80 Clazz.defineMethod (c$, "getNext", 
81 function () {
82 return this.next;
83 });
84 });