01: /**
02: * Copyright (C) 2006 NetMind Consulting Bt.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 3 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package hu.netmind.persistence;
18:
19: /**
20: * This object simply refers to another object.
21: * @author Brautigam Robert
22: * @version Revision: $Revision$
23: */
24: public class Referrer implements Comparable {
25: private int identity;
26: private Referrer ref;
27:
28: public Referrer() {
29: }
30:
31: public int getIdentity() {
32: return identity;
33: }
34:
35: public void setIdentity(int identity) {
36: this .identity = identity;
37: }
38:
39: public Referrer(int identity) {
40: this .identity = identity;
41: }
42:
43: public Referrer getRef() {
44: return ref;
45: }
46:
47: public void setRef(Referrer ref) {
48: this .ref = ref;
49: }
50:
51: public int compareTo(Object rhs) {
52: return ((Referrer) rhs).identity - identity;
53: }
54:
55: public int hashCode(int identity) {
56: return identity;
57: }
58:
59: public String toString() {
60: return "[Ref: " + identity + "]";
61: }
62:
63: public boolean equals(Object obj) {
64: if (!(obj instanceof Referrer))
65: return false;
66: return identity == ((Referrer) obj).identity;
67: }
68: }
|