001: /* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com
002:
003: This file is part of the db4o open source object database.
004:
005: db4o is free software; you can redistribute it and/or modify it under
006: the terms of version 2 of the GNU General Public License as published
007: by the Free Software Foundation and as clarified by db4objects' GPL
008: interpretation policy, available at
009: http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
010: Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
011: Suite 350, San Mateo, CA 94403, USA.
012:
013: db4o is distributed in the hope that it will be useful, but WITHOUT ANY
014: WARRANTY; without even the implied warranty of MERCHANTABILITY or
015: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
016: for more details.
017:
018: You should have received a copy of the GNU General Public License along
019: with this program; if not, write to the Free Software Foundation, Inc.,
020: 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
021: package com.db4o.test.types;
022:
023: import java.util.*;
024:
025: public class ArrayTypedPublic extends RTest {
026: public Boolean[] oBoolean;
027: public Boolean[] nBoolean;
028: public boolean[] sBoolean;
029:
030: public Byte[] oByte;
031: public Byte[] nByte;
032: public byte[] sByte;
033:
034: public Character[] oCharacter;
035: public Character[] nCharacter;
036: public char[] sChar;
037:
038: public Double[] oDouble;
039: public Double[] nDouble;
040: public double[] sDouble;
041:
042: public Float[] oFloat;
043: public Float[] nFloat;
044: public float[] sFloat;
045:
046: public Integer[] oInteger;
047: public Integer[] nInteger;
048: public int[] sInteger;
049:
050: public Long[] oLong;
051: public Long[] nLong;
052: public long[] sLong;
053:
054: public Short[] oShort;
055: public Short[] nShort;
056: public short[] sShort;
057:
058: public String[] oString;
059: public String[] nString;
060:
061: public Date[] oDate;
062: public Date[] nDate;
063:
064: public ObjectSimplePublic[] oObject;
065: public ObjectSimplePublic[] nObject;
066:
067: public void set(int ver) {
068: if (ver == 1) {
069: oBoolean = new Boolean[] { new Boolean(true),
070: new Boolean(false), null };
071: nBoolean = null;
072: sBoolean = new boolean[] { true, true, false };
073:
074: oByte = new Byte[] { new Byte(Byte.MAX_VALUE),
075: new Byte(Byte.MIN_VALUE), new Byte((byte) 0), null };
076: nByte = null;
077: sByte = new byte[] { Byte.MAX_VALUE, Byte.MIN_VALUE, 0, 1 };
078:
079: oCharacter = new Character[] {
080: new Character((char) (Character.MAX_VALUE - 1)),
081: new Character(Character.MIN_VALUE),
082: new Character((char) (0)), null };
083: nCharacter = null;
084: sChar = new char[] { (char) (Character.MAX_VALUE - 1),
085: Character.MIN_VALUE, (char) (0) };
086:
087: oDouble = new Double[] { new Double(Double.MAX_VALUE - 1),
088: new Double(Double.MIN_VALUE), new Double(0), null };
089: nDouble = null;
090: sDouble = new double[] { Double.MAX_VALUE - 1,
091: Double.MIN_VALUE, 0 };
092:
093: oFloat = new Float[] { new Float(Float.MAX_VALUE - 1),
094: new Float(Float.MIN_VALUE), new Float(0), null };
095: nFloat = null;
096: sFloat = new float[] { Float.MAX_VALUE - 1,
097: Float.MIN_VALUE, 0 };
098:
099: oInteger = new Integer[] {
100: new Integer(Integer.MAX_VALUE - 1),
101: new Integer(Integer.MIN_VALUE), new Integer(0),
102: null };
103: nInteger = null;
104: sInteger = new int[] { Integer.MAX_VALUE - 1,
105: Integer.MIN_VALUE, 0 };
106:
107: oLong = new Long[] { new Long(Long.MAX_VALUE - 1),
108: new Long(Long.MIN_VALUE), new Long(0), null };
109: nLong = null;
110: sLong = new long[] { Long.MAX_VALUE - 1, Long.MIN_VALUE, 0 };
111:
112: oShort = new Short[] {
113: new Short((short) (Short.MAX_VALUE - 1)),
114: new Short(Short.MIN_VALUE), new Short((short) (0)),
115: null };
116: nShort = null;
117: sShort = new short[] { (short) (Short.MAX_VALUE - 1),
118: Short.MIN_VALUE, (short) 0 };
119:
120: oString = new String[] { "db4o rules", "cool", "supergreat" };
121: nString = null;
122:
123: oDate = new Date[] {
124: new GregorianCalendar(2000, 0, 1).getTime(),
125: new GregorianCalendar(2000, 0, 1).getTime(),
126: new GregorianCalendar(2001, 11, 31).getTime(), null };
127: nDate = null;
128:
129: oObject = new ObjectSimplePublic[] {
130: new ObjectSimplePublic("so"), null,
131: new ObjectSimplePublic("far"),
132: new ObjectSimplePublic("O.K.") };
133: nObject = null;
134: } else {
135: oBoolean = new Boolean[] { new Boolean(false),
136: new Boolean(true), new Boolean(true) };
137: nBoolean = new Boolean[] { null, new Boolean(true),
138: new Boolean(false) };
139: sBoolean = new boolean[] { true, true, true };
140:
141: oByte = new Byte[] { new Byte(Byte.MIN_VALUE),
142: new Byte(Byte.MAX_VALUE), new Byte((byte) 1),
143: new Byte((byte) -1) };
144: nByte = new Byte[] { null, new Byte(Byte.MAX_VALUE),
145: new Byte(Byte.MIN_VALUE), new Byte((byte) 0) };
146: sByte = new byte[] { Byte.MIN_VALUE, Byte.MAX_VALUE, 0, -1,
147: 1 };
148:
149: oCharacter = new Character[] {
150: new Character(Character.MIN_VALUE),
151: new Character((char) (Character.MAX_VALUE - 1)),
152: new Character((char) (0)),
153: new Character((char) (Character.MAX_VALUE - 1)),
154: new Character((char) 1) };
155: nCharacter = new Character[] { null,
156: new Character((char) (Character.MAX_VALUE - 1)),
157: new Character(Character.MIN_VALUE),
158: new Character((char) (0)) };
159: sChar = new char[] { Character.MIN_VALUE, (char) (0) };
160:
161: oDouble = new Double[] { new Double(Double.MIN_VALUE),
162: new Double(0) };
163: nDouble = new Double[] { null,
164: new Double(Double.MAX_VALUE - 1),
165: new Double(Double.MIN_VALUE),
166: new Double(-123.12344),
167: new Double(-12345.123445566) };
168: sDouble = new double[] { Double.MAX_VALUE - 1,
169: Double.MIN_VALUE, 0, 0.12344, -123.12344 };
170:
171: oFloat = new Float[] { new Float((float) -98.765) };
172: nFloat = null;
173: sFloat = new float[] { (float) -0.55, Float.MAX_VALUE - 1,
174: Float.MIN_VALUE, 0, (float) 0.33 };
175:
176: oInteger = new Integer[] {
177: new Integer(Integer.MAX_VALUE - 1),
178: new Integer(Integer.MIN_VALUE), new Integer(111),
179: new Integer(-333) };
180: nInteger = new Integer[] { null,
181: new Integer(Integer.MAX_VALUE - 1),
182: new Integer(Integer.MIN_VALUE), new Integer(0) };
183: sInteger = new int[] { 888, 666, 999, 101010, 111111 };
184:
185: oLong = new Long[] { new Long(Long.MAX_VALUE - 1),
186: new Long(Long.MIN_VALUE), new Long(1) };
187: nLong = new Long[] { null, new Long(Long.MAX_VALUE - 1),
188: new Long(Long.MIN_VALUE), new Long(0) };
189: sLong = new long[] { Long.MAX_VALUE - 1, Long.MIN_VALUE };
190:
191: oShort = new Short[] { new Short(Short.MIN_VALUE),
192: new Short((short) (Short.MAX_VALUE - 1)),
193: new Short((short) (0)) };
194: nShort = new Short[] {
195: new Short((short) (Short.MAX_VALUE - 1)), null,
196: new Short(Short.MIN_VALUE), new Short((short) (0)) };
197: sShort = null;
198:
199: oString = new String[] { "db4o rulez", "cool", "supergreat" };
200: nString = new String[] { null, "db4o rules", "cool",
201: "supergreat", null };
202:
203: oDate = new Date[] {
204: new GregorianCalendar(2000, 0, 1).getTime(),
205: new GregorianCalendar(1999, 0, 1).getTime(),
206: new GregorianCalendar(2001, 11, 31).getTime() };
207: nDate = new Date[] { null,
208: new GregorianCalendar(2000, 0, 1).getTime(),
209: new GregorianCalendar(2000, 0, 1).getTime(),
210: new GregorianCalendar(2001, 11, 31).getTime(), null };
211:
212: oObject = new ObjectSimplePublic[] {
213: new ObjectSimplePublic("works"),
214: new ObjectSimplePublic("far"),
215: new ObjectSimplePublic("excellent") };
216: nObject = new ObjectSimplePublic[] {};
217: }
218: }
219: }
|