01: /**
02: * ===========================================
03: * JFreeReport : a free Java reporting library
04: * ===========================================
05: *
06: * Project Info: http://reporting.pentaho.org/
07: *
08: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
09: *
10: * This library is free software; you can redistribute it and/or modify it under the terms
11: * of the GNU Lesser General Public License as published by the Free Software Foundation;
12: * either version 2.1 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16: * See the GNU Lesser General Public License for more details.
17: *
18: * You should have received a copy of the GNU Lesser General Public License along with this
19: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20: * Boston, MA 02111-1307, USA.
21: *
22: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
23: * in the United States and other countries.]
24: *
25: * ------------
26: * PhysicalPageKey.java
27: * ------------
28: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
29: */package org.jfree.report.layout.output;
30:
31: import java.io.Serializable;
32:
33: /**
34: * A physical page-key identifies a generated page.
35: *
36: * @author Thomas Morgner
37: */
38: public final class PhysicalPageKey implements Serializable {
39: private LogicalPageKey logicalPage;
40: private int x;
41: private int y;
42:
43: public PhysicalPageKey(final LogicalPageKey logicalPage,
44: final int x, final int y) {
45: this .x = x;
46: this .y = y;
47: this .logicalPage = logicalPage;
48: }
49:
50: public LogicalPageKey getLogicalPage() {
51: return logicalPage;
52: }
53:
54: public int getX() {
55: return x;
56: }
57:
58: public int getY() {
59: return y;
60: }
61:
62: public boolean equals(final Object o) {
63: if (this == o) {
64: return true;
65: }
66: if (o == null || getClass() != o.getClass()) {
67: return false;
68: }
69:
70: final PhysicalPageKey that = (PhysicalPageKey) o;
71:
72: if (x != that.x) {
73: return false;
74: }
75: if (y != that.y) {
76: return false;
77: }
78: if (!logicalPage.equals(that.logicalPage)) {
79: return false;
80: }
81:
82: return true;
83: }
84:
85: public int hashCode() {
86: int result = logicalPage.hashCode();
87: result = 29 * result + x;
88: result = 29 * result + y;
89: return result;
90: }
91: }
|