KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > test > views > SetWidgetCounts


1 /*
2  * Copyright 2002 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: SetWidgetCounts.java,v 1.3 2002/10/17 21:01:00 pierreg0 Exp $
9  */

10
11 package com.triactive.jdo.test.views;
12
13 import com.triactive.jdo.test.*;
14
15
16 public class SetWidgetCounts extends TestObject
17 {
18     private SetWidget sw;
19     private int normalSetSize;
20     private int inverseSetSize;
21
22
23     /**
24      * Default constructor required since this is a PersistenceCapable class.
25      */

26     protected SetWidgetCounts() {}
27
28
29     public SetWidgetCounts(SetWidget sw)
30     {
31         this.sw = sw;
32         this.normalSetSize = sw.getNormalSet().size();
33         this.inverseSetSize = sw.getInverseSet().size();
34     }
35
36
37     public SetWidget getSetWidget()
38     {
39         return sw;
40     }
41
42
43     public void fillRandom()
44     {
45         throw new UnsupportedOperationException JavaDoc();
46     }
47
48
49     public boolean compareTo(Object JavaDoc obj)
50     {
51         if (obj == this)
52             return true;
53
54         if (!(obj instanceof SetWidgetCounts))
55             return false;
56
57         SetWidgetCounts swc = (SetWidgetCounts)obj;
58
59         return sw.compareTo(swc.sw)
60             && normalSetSize == swc.normalSetSize
61             && inverseSetSize == swc.inverseSetSize;
62     }
63
64
65     public String JavaDoc toString()
66     {
67         StringBuffer JavaDoc s = new StringBuffer JavaDoc(super.toString());
68
69         s.append(" sw = ").append(sw);
70         s.append('\n');
71         s.append(" normalSetSize = ").append(normalSetSize);
72         s.append('\n');
73         s.append(" inverseSetSize = ").append(inverseSetSize);
74         s.append('\n');
75
76         return s.toString();
77     }
78 }
79
Popular Tags