1 /*
2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package sun.awt.geom;
27 
28 import java.awt.geom.Rectangle2D;
29 import java.awt.geom.PathIterator;
30 import java.util.Vector;
31 
32 final class Order0 extends Curve {
33     private double x;
34     private double y;
35 
Order0(double x, double y)36     public Order0(double x, double y) {
37         super(INCREASING);
38         this.x = x;
39         this.y = y;
40     }
41 
getOrder()42     public int getOrder() {
43         return 0;
44     }
45 
getXTop()46     public double getXTop() {
47         return x;
48     }
49 
getYTop()50     public double getYTop() {
51         return y;
52     }
53 
getXBot()54     public double getXBot() {
55         return x;
56     }
57 
getYBot()58     public double getYBot() {
59         return y;
60     }
61 
getXMin()62     public double getXMin() {
63         return x;
64     }
65 
getXMax()66     public double getXMax() {
67         return x;
68     }
69 
getX0()70     public double getX0() {
71         return x;
72     }
73 
getY0()74     public double getY0() {
75         return y;
76     }
77 
getX1()78     public double getX1() {
79         return x;
80     }
81 
getY1()82     public double getY1() {
83         return y;
84     }
85 
XforY(double y)86     public double XforY(double y) {
87         return y;
88     }
89 
TforY(double y)90     public double TforY(double y) {
91         return 0;
92     }
93 
XforT(double t)94     public double XforT(double t) {
95         return x;
96     }
97 
YforT(double t)98     public double YforT(double t) {
99         return y;
100     }
101 
dXforT(double t, int deriv)102     public double dXforT(double t, int deriv) {
103         return 0;
104     }
105 
dYforT(double t, int deriv)106     public double dYforT(double t, int deriv) {
107         return 0;
108     }
109 
nextVertical(double t0, double t1)110     public double nextVertical(double t0, double t1) {
111         return t1;
112     }
113 
crossingsFor(double x, double y)114     public int crossingsFor(double x, double y) {
115         return 0;
116     }
117 
accumulateCrossings(Crossings c)118     public boolean accumulateCrossings(Crossings c) {
119         return (x > c.getXLo() &&
120                 x < c.getXHi() &&
121                 y > c.getYLo() &&
122                 y < c.getYHi());
123     }
124 
enlarge(Rectangle2D r)125     public void enlarge(Rectangle2D r) {
126         r.add(x, y);
127     }
128 
getSubCurve(double ystart, double yend, int dir)129     public Curve getSubCurve(double ystart, double yend, int dir) {
130         return this;
131     }
132 
getReversedCurve()133     public Curve getReversedCurve() {
134         return this;
135     }
136 
getSegment(double[] coords)137     public int getSegment(double[] coords) {
138         coords[0] = x;
139         coords[1] = y;
140         return PathIterator.SEG_MOVETO;
141     }
142 }
143