001: /**
002: * ===========================================
003: * JFreeReport : a free Java reporting library
004: * ===========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: * See the GNU Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public License along with this
019: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020: * Boston, MA 02111-1307, USA.
021: *
022: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023: * in the United States and other countries.]
024: *
025: * ------------
026: * StrictInsets.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.util.geom;
030:
031: /**
032: * Creation-Date: 09.07.2006, 20:22:06
033: *
034: * @author Thomas Morgner
035: */
036: public class StrictInsets implements Cloneable {
037: private long top;
038: private long bottom;
039: private long left;
040: private long right;
041:
042: public StrictInsets() {
043: }
044:
045: public StrictInsets(final long top, final long left,
046: final long bottom, final long right) {
047: this .top = top;
048: this .left = left;
049: this .bottom = bottom;
050: this .right = right;
051: }
052:
053: public long getTop() {
054: return top;
055: }
056:
057: public void setTop(final long top) {
058: this .top = top;
059: }
060:
061: public long getBottom() {
062: return bottom;
063: }
064:
065: public void setBottom(final long bottom) {
066: this .bottom = bottom;
067: }
068:
069: public long getLeft() {
070: return left;
071: }
072:
073: public void setLeft(final long left) {
074: this .left = left;
075: }
076:
077: public long getRight() {
078: return right;
079: }
080:
081: public void setRight(final long right) {
082: this .right = right;
083: }
084:
085: public boolean equals(final Object o) {
086: if (this == o) {
087: return true;
088: }
089: if (o == null || getClass() != o.getClass()) {
090: return false;
091: }
092:
093: final StrictInsets that = (StrictInsets) o;
094:
095: if (bottom != that.bottom) {
096: return false;
097: }
098: if (left != that.left) {
099: return false;
100: }
101: if (right != that.right) {
102: return false;
103: }
104: if (top != that.top) {
105: return false;
106: }
107:
108: return true;
109: }
110:
111: public int hashCode() {
112: int result = (int) (top ^ (top >>> 32));
113: result = 29 * result + (int) (bottom ^ (bottom >>> 32));
114: result = 29 * result + (int) (left ^ (left >>> 32));
115: result = 29 * result + (int) (right ^ (right >>> 32));
116: return result;
117: }
118:
119: /**
120: * Returns a string representation of the object. In general, the
121: * <code>toString</code> method returns a string that "textually represents"
122: * this object. The result should be a concise but informative representation
123: * that is easy for a person to read. It is recommended that all subclasses
124: * override this method.
125: * <p/>
126: * The <code>toString</code> method for class <code>Object</code> returns a
127: * string consisting of the name of the class of which the object is an
128: * instance, the at-sign character `<code>@</code>', and the unsigned
129: * hexadecimal representation of the hash code of the object. In other words,
130: * this method returns a string equal to the value of: <blockquote>
131: * <pre>
132: * getClass().getName() + '@' + Integer.toHexString(hashCode())
133: * </pre></blockquote>
134: *
135: *
136: * @return a string representation of the object.
137: */
138: public String toString() {
139: final StringBuffer b = new StringBuffer();
140: b.append(getClass().getName());
141: b.append("={top=");
142: b.append(top);
143: b.append(", left=");
144: b.append(left);
145: b.append(", bottom=");
146: b.append(bottom);
147: b.append(", right=");
148: b.append(right);
149: b.append('}');
150: return b.toString();
151: }
152:
153: /**
154: * Returns a copy of this bounds object. This method will never throw a
155: * 'CloneNotSupportedException'.
156: *
157: * @return the cloned instance.
158: */
159: public Object clone() {
160: try {
161: return super .clone();
162: } catch (CloneNotSupportedException e) {
163: throw new InternalError("Clone must always be supported.");
164: }
165: }
166:
167: }
|