01: /*
02: * Copyright 2003 (C) TJDO.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the TJDO License version 1.0.
06: * See the terms of the TJDO License in the documentation provided with this software.
07: *
08: * $Id: Collision.java,v 1.1 2003/08/03 01:58:17 jackknifebarber Exp $
09: */
10:
11: package com.triactive.jdo.test.naming.foo;
12:
13: import com.triactive.jdo.test.TestObject;
14: import javax.jdo.JDOHelper;
15:
16: /**
17: * A test object whose class name is intended to collide with the same name in
18: * another package.
19: *
20: * @author <a href="mailto:mmartin5@austin.rr.com">Mike Martin</a>
21: * @version $Revision: 1.1 $
22: */
23:
24: public class Collision extends TestObject {
25: private int dummy;
26:
27: public Collision() {
28: super ();
29: }
30:
31: public void fillRandom() {
32: dummy = r.nextInt();
33: }
34:
35: public boolean compareTo(Object obj) {
36: if (obj == this )
37: return true;
38:
39: if (!(obj instanceof Collision))
40: return false;
41:
42: Collision c = (Collision) obj;
43:
44: return dummy == c.dummy;
45: }
46:
47: public String toString() {
48: StringBuffer s = new StringBuffer(getClass().getName() + ":");
49:
50: s.append(" JVM id = ").append(System.identityHashCode(this ));
51: s.append('\n');
52: s.append(" JDO id = ").append(JDOHelper.getObjectId(this ));
53: s.append('\n');
54: s.append(" dummy = ").append(dummy);
55: s.append('\n');
56:
57: return s.toString();
58: }
59: }
|