01: /*
02: * Copyright 2002 (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: WidgetAverages.java,v 1.2 2002/10/17 21:01:00 pierreg0 Exp $
09: */
10:
11: package com.triactive.jdo.test;
12:
13: class WidgetAverages extends TestObject {
14: private boolean booleanValue = false;
15: private short avgShortValue = 0;
16: private int avgIntValue = 0;
17:
18: public WidgetAverages() {
19: }
20:
21: public boolean getBooleanValue() {
22: return booleanValue;
23: }
24:
25: public short getAvgShortValue() {
26: return avgShortValue;
27: }
28:
29: public int getAvgIntValue() {
30: return avgIntValue;
31: }
32:
33: public void fillRandom() {
34: booleanValue = r.nextBoolean();
35: avgShortValue = (short) (r.nextInt(Short.MAX_VALUE * 2) - Short.MAX_VALUE);
36: avgIntValue = r.nextInt();
37: }
38:
39: public boolean compareTo(Object obj) {
40: if (obj == this )
41: return true;
42:
43: if (!(obj instanceof WidgetAverages))
44: return false;
45:
46: WidgetAverages wv = (WidgetAverages) obj;
47:
48: return booleanValue == wv.booleanValue
49: && avgShortValue == wv.avgShortValue
50: && avgIntValue == wv.avgIntValue;
51: }
52:
53: public String toString() {
54: StringBuffer s = new StringBuffer(super .toString());
55:
56: s.append(" booleanValue = ").append(booleanValue);
57: s.append('\n');
58: s.append(" avgShortValue = ").append(avgShortValue);
59: s.append('\n');
60: s.append(" avgIntValue = ").append(avgIntValue);
61: s.append('\n');
62:
63: return s.toString();
64: }
65: }
|