KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > test > types > TypedPublic


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o.test.types;
22
23 import java.util.*;
24
25 public class TypedPublic extends RTest
26 {
27     public Boolean JavaDoc oBoolean;
28     public Boolean JavaDoc nBoolean;
29     public boolean sBoolean;
30     
31     public Byte JavaDoc oByte;
32     public Byte JavaDoc nByte;
33     public byte sByte;
34     
35     public Character JavaDoc oCharacter;
36     public Character JavaDoc nCharacter;
37     public char sChar;
38
39     public Double JavaDoc oDouble;
40     public Double JavaDoc nDouble;
41     public double sDouble;
42     
43     public Float JavaDoc oFloat;
44     public Float JavaDoc nFloat;
45     public float sFloat;
46     
47     public Integer JavaDoc oInteger;
48     public Integer JavaDoc nInteger;
49     public int sInteger;
50     
51     public Long JavaDoc oLong;
52     public Long JavaDoc nLong;
53     public long sLong;
54
55     public Short JavaDoc oShort;
56     public Short JavaDoc nShort;
57     public short sShort;
58     
59     public String JavaDoc oString;
60     public String JavaDoc nString;
61     
62     public Date oDate;
63     public Date nDate;
64     
65     public ObjectSimplePublic oObject;
66     public ObjectSimplePublic nObject;
67
68     public void set(int ver){
69         if(ver == 1){
70             oBoolean = new Boolean JavaDoc(true);
71             nBoolean = null;
72             sBoolean = false;
73     
74             oByte = new Byte JavaDoc(Byte.MAX_VALUE);
75             nByte = null;
76             sByte = Byte.MIN_VALUE;
77         
78             oCharacter = new Character JavaDoc((char)(Character.MAX_VALUE - 1));
79             nCharacter = null;
80             sChar = Character.MIN_VALUE;
81
82             oDouble = new Double JavaDoc(Double.MAX_VALUE - 1);
83             nDouble = null;
84             sDouble = Double.MIN_VALUE;
85     
86             oFloat = new Float JavaDoc(Float.MAX_VALUE - 1);
87             nFloat = null;
88             sFloat = Float.MIN_VALUE;
89     
90             oInteger = new Integer JavaDoc(Integer.MAX_VALUE - 1);
91             nInteger = null;
92             sInteger = Integer.MIN_VALUE;
93     
94             oLong = new Long JavaDoc(Long.MAX_VALUE - 1);
95             nLong = null;
96             sLong = Long.MIN_VALUE;
97
98             oShort = new Short JavaDoc((short)(Short.MAX_VALUE - 1));
99             nShort = null;
100             sShort = Short.MIN_VALUE;
101     
102             oString = "db4o rules";
103             nString = null;
104         
105             oDate = new GregorianCalendar(2000,0,1).getTime();
106             nDate = null;
107         
108             oObject = new ObjectSimplePublic("s1");
109             nObject = null;
110         }else{
111             oBoolean = new Boolean JavaDoc(false);
112             nBoolean = new Boolean JavaDoc(true);
113             sBoolean = true;
114     
115             oByte = new Byte JavaDoc((byte)0);
116             nByte = new Byte JavaDoc(Byte.MIN_VALUE);
117             sByte = Byte.MAX_VALUE;
118         
119             oCharacter = new Character JavaDoc((char)0);
120             nCharacter = new Character JavaDoc(Character.MIN_VALUE);
121             sChar = (char)(Character.MAX_VALUE - 1);
122
123             oDouble = new Double JavaDoc(0);
124             nDouble = new Double JavaDoc(Double.MIN_VALUE);
125             sDouble = Double.MAX_VALUE - 1;
126     
127             oFloat = new Float JavaDoc(0);
128             nFloat = new Float JavaDoc(Float.MIN_VALUE);
129             sFloat = Float.MAX_VALUE - 1;
130     
131             oInteger = new Integer JavaDoc(0);
132             nInteger = new Integer JavaDoc(Integer.MIN_VALUE);
133             sInteger = Integer.MAX_VALUE - 1;
134     
135             oLong = new Long JavaDoc(0);
136             nLong = new Long JavaDoc(Long.MIN_VALUE);
137             sLong = Long.MAX_VALUE - 1;
138
139             oShort = new Short JavaDoc((short)0);
140             nShort = new Short JavaDoc(Short.MIN_VALUE);
141             sShort = (short)(Short.MAX_VALUE - 1);
142     
143             oString = "db4o rules of course";
144             nString = "yeah";
145         
146             oDate = null;
147             nDate = new GregorianCalendar(2001,1,1).getTime();
148         
149             oObject = new ObjectSimplePublic("s2o");
150             nObject = new ObjectSimplePublic("s2n");
151         }
152     }
153 }
154
Popular Tags