001: /*
002: * Copyright 2002 (C) TJDO.
003: * All rights reserved.
004: *
005: * This software is distributed under the terms of the TJDO License version 1.0.
006: * See the terms of the TJDO License in the documentation provided with this software.
007: *
008: * $Id: MinMaxWidgetValues.java,v 1.1 2003/02/23 08:39:12 jackknifebarber Exp $
009: */
010:
011: package com.triactive.jdo.test.views;
012:
013: import com.triactive.jdo.test.TestObject;
014:
015: class MinMaxWidgetValues extends TestObject {
016: private boolean booleanValue;
017: private byte minByteValue;
018: private short minShortValue;
019: private int maxIntValue;
020: private long maxLongValue;
021:
022: /**
023: * Default constructor required since this is a PersistenceCapable class.
024: */
025: protected MinMaxWidgetValues() {
026: }
027:
028: public MinMaxWidgetValues(boolean booleanValue) {
029: this .booleanValue = booleanValue;
030: this .minByteValue = Byte.MAX_VALUE;
031: this .minShortValue = Short.MAX_VALUE;
032: this .maxIntValue = Integer.MIN_VALUE;
033: this .maxLongValue = Long.MIN_VALUE;
034: }
035:
036: public boolean getBooleanValue() {
037: return booleanValue;
038: }
039:
040: public byte getMinByteValue() {
041: return minByteValue;
042: }
043:
044: public short getMinShortValue() {
045: return minShortValue;
046: }
047:
048: public int getMaxIntValue() {
049: return maxIntValue;
050: }
051:
052: public long getMaxLongValue() {
053: return maxLongValue;
054: }
055:
056: public void setMinByteValue(byte minByteValue) {
057: this .minByteValue = minByteValue;
058: }
059:
060: public void setMinShortValue(short minShortValue) {
061: this .minShortValue = minShortValue;
062: }
063:
064: public void setMaxIntValue(int maxIntValue) {
065: this .maxIntValue = maxIntValue;
066: }
067:
068: public void setMaxLongValue(long maxLongValue) {
069: this .maxLongValue = maxLongValue;
070: }
071:
072: public void fillRandom() {
073: booleanValue = r.nextBoolean();
074: minByteValue = (byte) (r.nextInt(Byte.MAX_VALUE * 2) - Byte.MAX_VALUE);
075: minShortValue = (short) (r.nextInt(Short.MAX_VALUE * 2) - Short.MAX_VALUE);
076: maxIntValue = r.nextInt();
077: maxLongValue = r.nextLong();
078: }
079:
080: public boolean compareTo(Object obj) {
081: if (obj == this )
082: return true;
083:
084: if (!(obj instanceof MinMaxWidgetValues))
085: return false;
086:
087: MinMaxWidgetValues wv = (MinMaxWidgetValues) obj;
088:
089: return booleanValue == wv.booleanValue
090: && minByteValue == wv.minByteValue
091: && minShortValue == wv.minShortValue
092: && maxIntValue == wv.maxIntValue
093: && maxLongValue == wv.maxLongValue;
094: }
095:
096: public String toString() {
097: StringBuffer s = new StringBuffer(super .toString());
098:
099: s.append(" booleanValue = ").append(booleanValue);
100: s.append('\n');
101: s.append(" minByteValue = ").append(minByteValue);
102: s.append('\n');
103: s.append(" minShortValue = ").append(minShortValue);
104: s.append('\n');
105: s.append(" maxIntValue = ").append(maxIntValue);
106: s.append('\n');
107: s.append(" maxLongValue = ").append(maxLongValue);
108: s.append('\n');
109:
110: return s.toString();
111: }
112: }
|