1 10 11 package com.triactive.jdo.test; 12 13 14 class WidgetAverages extends TestObject 15 { 16 private boolean booleanValue = false; 17 private short avgShortValue = 0; 18 private int avgIntValue = 0; 19 20 21 public WidgetAverages() 22 { 23 } 24 25 26 public boolean getBooleanValue() 27 { 28 return booleanValue; 29 } 30 31 32 public short getAvgShortValue() 33 { 34 return avgShortValue; 35 } 36 37 38 public int getAvgIntValue() 39 { 40 return avgIntValue; 41 } 42 43 44 public void fillRandom() 45 { 46 booleanValue = r.nextBoolean(); 47 avgShortValue = (short)(r.nextInt(Short.MAX_VALUE * 2) - Short.MAX_VALUE); 48 avgIntValue = r.nextInt(); 49 } 50 51 52 public boolean compareTo(Object obj) 53 { 54 if (obj == this) 55 return true; 56 57 if (!(obj instanceof WidgetAverages)) 58 return false; 59 60 WidgetAverages wv = (WidgetAverages)obj; 61 62 return booleanValue == wv.booleanValue 63 && avgShortValue == wv.avgShortValue 64 && avgIntValue == wv.avgIntValue; 65 } 66 67 68 public String toString() 69 { 70 StringBuffer s = new StringBuffer (super.toString()); 71 72 s.append(" booleanValue = ").append(booleanValue); 73 s.append('\n'); 74 s.append(" avgShortValue = ").append(avgShortValue); 75 s.append('\n'); 76 s.append(" avgIntValue = ").append(avgIntValue); 77 s.append('\n'); 78 79 return s.toString(); 80 } 81 } 82 | Popular Tags |