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: SetWidgetCounts.java,v 1.3 2002/10/17 21:01:00 pierreg0 Exp $
09: */
10:
11: package com.triactive.jdo.test.views;
12:
13: import com.triactive.jdo.test.*;
14:
15: public class SetWidgetCounts extends TestObject {
16: private SetWidget sw;
17: private int normalSetSize;
18: private int inverseSetSize;
19:
20: /**
21: * Default constructor required since this is a PersistenceCapable class.
22: */
23: protected SetWidgetCounts() {
24: }
25:
26: public SetWidgetCounts(SetWidget sw) {
27: this .sw = sw;
28: this .normalSetSize = sw.getNormalSet().size();
29: this .inverseSetSize = sw.getInverseSet().size();
30: }
31:
32: public SetWidget getSetWidget() {
33: return sw;
34: }
35:
36: public void fillRandom() {
37: throw new UnsupportedOperationException();
38: }
39:
40: public boolean compareTo(Object obj) {
41: if (obj == this )
42: return true;
43:
44: if (!(obj instanceof SetWidgetCounts))
45: return false;
46:
47: SetWidgetCounts swc = (SetWidgetCounts) obj;
48:
49: return sw.compareTo(swc.sw)
50: && normalSetSize == swc.normalSetSize
51: && inverseSetSize == swc.inverseSetSize;
52: }
53:
54: public String toString() {
55: StringBuffer s = new StringBuffer(super .toString());
56:
57: s.append(" sw = ").append(sw);
58: s.append('\n');
59: s.append(" normalSetSize = ").append(normalSetSize);
60: s.append('\n');
61: s.append(" inverseSetSize = ").append(inverseSetSize);
62: s.append('\n');
63:
64: return s.toString();
65: }
66: }
|