KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > common > dods > XYConstraints


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Paul Mahar
21  *
22  */

23 package org.enhydra.kelp.common.dods;
24
25
26 import java.io.Serializable JavaDoc;
27
28 public class XYConstraints
29     implements Cloneable JavaDoc, Serializable JavaDoc
30 {
31
32     int x;
33     int y;
34     int width;
35     int height;
36
37     public XYConstraints()
38     {
39         this(0, 0, 0, 0);
40     }
41
42     public XYConstraints(int x, int y, int width, int height)
43     {
44         this.x = x;
45         this.y = y;
46         this.width = width;
47         this.height = height;
48     }
49
50     public int getX()
51     {
52         return x;
53     }
54
55     public void setX(int x)
56     {
57         this.x = x;
58     }
59
60     public int getY()
61     {
62         return y;
63     }
64
65     public void setY(int y)
66     {
67         this.y = y;
68     }
69
70     public int getWidth()
71     {
72         return width;
73     }
74
75     public void setWidth(int width)
76     {
77         this.width = width;
78     }
79
80     public int getHeight()
81     {
82         return height;
83     }
84
85     public void setHeight(int height)
86     {
87         this.height = height;
88     }
89
90     public int hashCode()
91     {
92         return x ^ y * 37 ^ width * 43 ^ height * 47;
93     }
94
95     public boolean equals(Object JavaDoc that)
96     {
97         if(that instanceof XYConstraints)
98         {
99             XYConstraints other = (XYConstraints)that;
100             return other.x == x && other.y == y && other.width == width && other.height == height;
101         } else
102         {
103             return false;
104         }
105     }
106
107     public Object JavaDoc clone()
108     {
109         return new XYConstraints(x, y, width, height);
110     }
111
112     public String JavaDoc toString()
113     {
114         return String.valueOf(String.valueOf((new StringBuffer JavaDoc("XYConstraints[")).append(x).append(",").append(y).append(",").append(width).append(",").append(height).append("]")));
115     }
116 }
117
Popular Tags