KickJava   Java API By Example, From Geeks To Geeks.

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


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: MinMaxWidgetValues.java,v 1.1 2003/02/23 08:39:12 jackknifebarber Exp $
9  */

10
11 package com.triactive.jdo.test.views;
12
13 import com.triactive.jdo.test.TestObject;
14
15
16 class MinMaxWidgetValues extends TestObject
17 {
18     private boolean booleanValue;
19     private byte minByteValue;
20     private short minShortValue;
21     private int maxIntValue;
22     private long maxLongValue;
23
24
25     /**
26      * Default constructor required since this is a PersistenceCapable class.
27      */

28     protected MinMaxWidgetValues() {}
29
30
31     public MinMaxWidgetValues(boolean booleanValue)
32     {
33         this.booleanValue = booleanValue;
34         this.minByteValue = Byte.MAX_VALUE;
35         this.minShortValue = Short.MAX_VALUE;
36         this.maxIntValue = Integer.MIN_VALUE;
37         this.maxLongValue = Long.MIN_VALUE;
38     }
39
40
41     public boolean getBooleanValue()
42     {
43         return booleanValue;
44     }
45
46
47     public byte getMinByteValue()
48     {
49         return minByteValue;
50     }
51
52
53     public short getMinShortValue()
54     {
55         return minShortValue;
56     }
57
58
59     public int getMaxIntValue()
60     {
61         return maxIntValue;
62     }
63
64
65     public long getMaxLongValue()
66     {
67         return maxLongValue;
68     }
69
70
71     public void setMinByteValue(byte minByteValue)
72     {
73         this.minByteValue = minByteValue;
74     }
75
76
77     public void setMinShortValue(short minShortValue)
78     {
79         this.minShortValue = minShortValue;
80     }
81
82
83     public void setMaxIntValue(int maxIntValue)
84     {
85         this.maxIntValue = maxIntValue;
86     }
87
88
89     public void setMaxLongValue(long maxLongValue)
90     {
91         this.maxLongValue = maxLongValue;
92     }
93
94
95     public void fillRandom()
96     {
97         booleanValue = r.nextBoolean();
98         minByteValue = (byte)(r.nextInt(Byte.MAX_VALUE * 2) - Byte.MAX_VALUE);
99         minShortValue = (short)(r.nextInt(Short.MAX_VALUE * 2) - Short.MAX_VALUE);
100         maxIntValue = r.nextInt();
101         maxLongValue = r.nextLong();
102     }
103
104
105     public boolean compareTo(Object JavaDoc obj)
106     {
107         if (obj == this)
108             return true;
109
110         if (!(obj instanceof MinMaxWidgetValues))
111             return false;
112
113         MinMaxWidgetValues wv = (MinMaxWidgetValues)obj;
114
115         return booleanValue == wv.booleanValue
116             && minByteValue == wv.minByteValue
117             && minShortValue == wv.minShortValue
118             && maxIntValue == wv.maxIntValue
119             && maxLongValue == wv.maxLongValue;
120     }
121
122
123     public String JavaDoc toString()
124     {
125         StringBuffer JavaDoc s = new StringBuffer JavaDoc(super.toString());
126
127         s.append(" booleanValue = ").append(booleanValue);
128         s.append('\n');
129         s.append(" minByteValue = ").append(minByteValue);
130         s.append('\n');
131         s.append(" minShortValue = ").append(minShortValue);
132         s.append('\n');
133         s.append(" maxIntValue = ").append(maxIntValue);
134         s.append('\n');
135         s.append(" maxLongValue = ").append(maxLongValue);
136         s.append('\n');
137
138         return s.toString();
139     }
140 }
141
Popular Tags