1 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 24 25 public class Collision extends TestObject 26 { 27 private int dummy; 28 29 30 public Collision() 31 { 32 super(); 33 } 34 35 36 public void fillRandom() 37 { 38 dummy = r.nextInt(); 39 } 40 41 42 public boolean compareTo(Object obj) 43 { 44 if (obj == this) 45 return true; 46 47 if (!(obj instanceof Collision)) 48 return false; 49 50 Collision c = (Collision)obj; 51 52 return dummy == c.dummy; 53 } 54 55 56 public String toString() 57 { 58 StringBuffer s = new StringBuffer (getClass().getName() + ":"); 59 60 s.append(" JVM id = ").append(System.identityHashCode(this)); 61 s.append('\n'); 62 s.append(" JDO id = ").append(JDOHelper.getObjectId(this)); 63 s.append('\n'); 64 s.append(" dummy = ").append(dummy); 65 s.append('\n'); 66 67 return s.toString(); 68 } 69 } 70 | Popular Tags |