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 ArrayTypedPrivate extends RTest {
026: private Boolean[] oBoolean;
027: private Boolean[] nBoolean;
028: private boolean[] sBoolean;
029:
030: /*
031: private Byte[] oByte;
032: private Byte[] nByte;
033: private byte[] sByte;
034: */
035:
036: private Character[] oCharacter;
037: private Character[] nCharacter;
038: private char[] sChar;
039:
040: private Double[] oDouble;
041: private Double[] nDouble;
042: private double[] sDouble;
043:
044: private Float[] oFloat;
045: private Float[] nFloat;
046: private float[] sFloat;
047:
048: private Integer[] oInteger;
049: private Integer[] nInteger;
050: private int[] sInteger;
051:
052: private Long[] oLong;
053: private Long[] nLong;
054: private long[] sLong;
055:
056: private Short[] oShort;
057: private Short[] nShort;
058: private short[] sShort;
059:
060: private String[] oString;
061: private String[] nString;
062:
063: private Date[] oDate;
064: private Date[] nDate;
065:
066: private ObjectSimplePrivate[] oObject;
067: private ObjectSimplePrivate[] nObject;
068:
069: public void set(int ver) {
070: if (ver == 1) {
071: oBoolean = new Boolean[] { new Boolean(true),
072: new Boolean(false), null };
073: nBoolean = null;
074: sBoolean = new boolean[] { true, true, false };
075:
076: /*
077: oByte = new Byte[]{ new Byte(Byte.MAX_VALUE), new Byte(Byte.MIN_VALUE), new Byte((byte)0), null};
078: nByte = null;
079: sByte = new byte[]{Byte.MAX_VALUE, Byte.MIN_VALUE, 0, 1};
080: */
081:
082: oCharacter = new Character[] {
083: new Character((char) (Character.MAX_VALUE - 1)),
084: new Character(Character.MIN_VALUE),
085: new Character((char) (0)), null };
086: nCharacter = null;
087: sChar = new char[] { (char) (Character.MAX_VALUE - 1),
088: Character.MIN_VALUE, (char) (0) };
089:
090: oDouble = new Double[] { new Double(Double.MAX_VALUE - 1),
091: new Double(Double.MIN_VALUE), new Double(0), null };
092: nDouble = null;
093: sDouble = new double[] { Double.MAX_VALUE - 1,
094: Double.MIN_VALUE, 0 };
095:
096: oFloat = new Float[] { new Float(Float.MAX_VALUE - 1),
097: new Float(Float.MIN_VALUE), new Float(0), null };
098: nFloat = null;
099: sFloat = new float[] { Float.MAX_VALUE - 1,
100: Float.MIN_VALUE, 0 };
101:
102: oInteger = new Integer[] {
103: new Integer(Integer.MAX_VALUE - 1),
104: new Integer(Integer.MIN_VALUE), new Integer(0),
105: null };
106: nInteger = null;
107: sInteger = new int[] { Integer.MAX_VALUE - 1,
108: Integer.MIN_VALUE, 0 };
109:
110: oLong = new Long[] { new Long(Long.MAX_VALUE - 1),
111: new Long(Long.MIN_VALUE), new Long(0), null };
112: nLong = null;
113: sLong = new long[] { Long.MAX_VALUE - 1, Long.MIN_VALUE, 0 };
114:
115: oShort = new Short[] {
116: new Short((short) (Short.MAX_VALUE - 1)),
117: new Short(Short.MIN_VALUE), new Short((short) (0)),
118: null };
119: nShort = null;
120: sShort = new short[] { (short) (Short.MAX_VALUE - 1),
121: Short.MIN_VALUE, (short) 0 };
122:
123: oString = new String[] { "db4o rules", "cool", "supergreat" };
124: nString = null;
125:
126: oDate = new Date[] {
127: new GregorianCalendar(2000, 0, 1).getTime(),
128: new GregorianCalendar(2000, 0, 1).getTime(),
129: new GregorianCalendar(2001, 11, 31).getTime(), null };
130: nDate = null;
131:
132: oObject = new ObjectSimplePrivate[] {
133: new ObjectSimplePrivate("so"), null,
134: new ObjectSimplePrivate("far"),
135: new ObjectSimplePrivate("O.K.") };
136: nObject = null;
137: } else {
138: oBoolean = new Boolean[] { new Boolean(false),
139: new Boolean(true), new Boolean(true) };
140: nBoolean = new Boolean[] { null, new Boolean(true),
141: new Boolean(false) };
142: sBoolean = new boolean[] { true, true, true };
143:
144: /*
145: oByte = new Byte[]{ new Byte(Byte.MIN_VALUE), new Byte(Byte.MAX_VALUE), new Byte((byte)1), new Byte((byte)-1)};
146: nByte = new Byte[]{ null, new Byte(Byte.MAX_VALUE), new Byte(Byte.MIN_VALUE), new Byte((byte)0)};
147: sByte = new byte[]{Byte.MIN_VALUE, Byte.MAX_VALUE, 0, -1, 1};
148: */
149:
150: oCharacter = new Character[] {
151: new Character(Character.MIN_VALUE),
152: new Character((char) (Character.MAX_VALUE - 1)),
153: new Character((char) (0)),
154: new Character((char) (Character.MAX_VALUE - 1)),
155: new Character((char) 1) };
156: nCharacter = new Character[] { null,
157: new Character((char) (Character.MAX_VALUE - 1)),
158: new Character(Character.MIN_VALUE),
159: new Character((char) (0)) };
160: sChar = new char[] { Character.MIN_VALUE, (char) (0) };
161:
162: oDouble = new Double[] { new Double(Double.MIN_VALUE),
163: new Double(0) };
164: nDouble = new Double[] { null,
165: new Double(Double.MAX_VALUE - 1),
166: new Double(Double.MIN_VALUE),
167: new Double(-123.12344),
168: new Double(-12345.123445566) };
169: sDouble = new double[] { Double.MAX_VALUE - 1,
170: Double.MIN_VALUE, 0, 0.12344, -123.12344 };
171:
172: oFloat = new Float[] { new Float((float) -98.765) };
173: nFloat = null;
174: sFloat = new float[] { (float) -0.55, Float.MAX_VALUE - 1,
175: Float.MIN_VALUE, 0, (float) 0.33 };
176:
177: oInteger = new Integer[] {
178: new Integer(Integer.MAX_VALUE - 1),
179: new Integer(Integer.MIN_VALUE), new Integer(111),
180: new Integer(-333) };
181: nInteger = new Integer[] { null,
182: new Integer(Integer.MAX_VALUE - 1),
183: new Integer(Integer.MIN_VALUE), new Integer(0) };
184: sInteger = new int[] { 888, 666, 999, 101010, 111111 };
185:
186: oLong = new Long[] { new Long(Long.MAX_VALUE - 1),
187: new Long(Long.MIN_VALUE), new Long(1) };
188: nLong = new Long[] { null, new Long(Long.MAX_VALUE - 1),
189: new Long(Long.MIN_VALUE), new Long(0) };
190: sLong = new long[] { Long.MAX_VALUE - 1, Long.MIN_VALUE };
191:
192: oShort = new Short[] { new Short(Short.MIN_VALUE),
193: new Short((short) (Short.MAX_VALUE - 1)),
194: new Short((short) (0)) };
195: nShort = new Short[] {
196: new Short((short) (Short.MAX_VALUE - 1)), null,
197: new Short(Short.MIN_VALUE), new Short((short) (0)) };
198: sShort = null;
199:
200: oString = new String[] { "db4o rulez", "cool", "supergreat" };
201: nString = new String[] { null, "db4o rules", "cool",
202: "supergreat", null };
203:
204: oDate = new Date[] {
205: new GregorianCalendar(2000, 0, 1).getTime(),
206: new GregorianCalendar(1999, 0, 1).getTime(),
207: new GregorianCalendar(2001, 11, 31).getTime() };
208: nDate = new Date[] { null,
209: new GregorianCalendar(2000, 0, 1).getTime(),
210: new GregorianCalendar(2000, 0, 1).getTime(),
211: new GregorianCalendar(2001, 11, 31).getTime(), null };
212:
213: oObject = new ObjectSimplePrivate[] {
214: new ObjectSimplePrivate("works"),
215: new ObjectSimplePrivate("far"),
216: new ObjectSimplePrivate("excellent") };
217: nObject = new ObjectSimplePrivate[] {};
218: }
219: }
220:
221: public boolean jdk2() {
222: return true;
223: }
224: }
|