KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > gui > graph > model > Rect


1 /***
2  * FractalGUI: a graphical tool to edit Fractal component configurations.
3  * Copyright (C) 2003 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: fractal@objectweb.org
20  *
21  * Authors: Eric Bruneton, Patrice Fauvel
22  */

23
24 package org.objectweb.fractal.gui.graph.model;
25
26 /**
27  * A rectangle whose coordinates are stored as <tt>double</tt>.
28  */

29
30 public class Rect {
31
32   /**
33    * x coordinate of the left border of this rectangle.
34    */

35
36   public final double x0;
37
38   /**
39    * y coordinate of the top border of this rectangle.
40    */

41
42   public final double y0;
43
44   /**
45    * x coordinate of the right border of this rectangle.
46    */

47
48   public final double x1;
49
50   /**
51    * y coordinate of the bottom border of this rectangle.
52    */

53
54   public final double y1;
55
56   /**
57    * Constructs a new {@link Rect} object.
58    *
59    * @param x0 x coordinate of the left border of this rectangle.
60    * @param y0 y coordinate of the top border of this rectangle.
61    * @param x1 x coordinate of the right border of this rectangle.
62    * @param y1 y coordinate of the bottom border of this rectangle.
63    */

64
65   public Rect (
66     final double x0,
67     final double y0,
68     final double x1,
69     final double y1)
70   {
71     this.x0 = x0;
72     this.y0 = y0;
73     this.x1 = x1;
74     this.y1 = y1;
75   }
76
77   public boolean equals (final Object JavaDoc o) {
78     if (o instanceof Rect) {
79       Rect r = (Rect)o;
80       return x0 == r.x0 && y0 == r.y0 && x1 == r.x1 && y1 == r.y1;
81     }
82     return false;
83   }
84 }
85
Popular Tags