You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2003/02/28 22:21:51 UTC
cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections/primitives TestArrayIntList.java TestArrayUnsignedShortList.java
rwaldhoff 2003/02/28 13:21:51
Modified: collections/src/java/org/apache/commons/collections/primitives/adapters
CollectionIntCollection.java
IntCollectionCollection.java IntListList.java
NonSerializableCollectionIntCollection.java
NonSerializableListIntList.java
collections/src/test/org/apache/commons/collections/primitives
TestArrayIntList.java
TestArrayUnsignedShortList.java
Added: collections/src/java/org/apache/commons/collections/primitives/adapters
AbstractIntCollectionCollection.java
AbstractIntListList.java
NonSerializableIntCollectionCollection.java
NonSerializableIntListList.java
Log:
better handling of serializablity w.r.t. sublists
make some types final
Revision Changes Path
1.6 +3 -3 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/CollectionIntCollection.java
Index: CollectionIntCollection.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/CollectionIntCollection.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CollectionIntCollection.java 28 Feb 2003 00:17:53 -0000 1.5
+++ CollectionIntCollection.java 28 Feb 2003 21:21:51 -0000 1.6
@@ -75,7 +75,7 @@
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
-public class CollectionIntCollection extends AbstractCollectionIntCollection implements Serializable {
+final public class CollectionIntCollection extends AbstractCollectionIntCollection implements Serializable {
/**
* Create an {@link IntCollection IntCollection} wrapping
* the specified {@link Collection Collection}. When
1.5 +12 -109 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntCollectionCollection.java
Index: IntCollectionCollection.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntCollectionCollection.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IntCollectionCollection.java 26 Feb 2003 19:17:23 -0000 1.4
+++ IntCollectionCollection.java 28 Feb 2003 21:21:51 -0000 1.5
@@ -58,9 +58,7 @@
package org.apache.commons.collections.primitives.adapters;
import java.io.Serializable;
-import java.lang.reflect.Array;
import java.util.Collection;
-import java.util.Iterator;
import org.apache.commons.collections.primitives.IntCollection;
@@ -77,7 +75,7 @@
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
-public class IntCollectionCollection implements Collection, Serializable {
+final public class IntCollectionCollection extends AbstractIntCollectionCollection implements Serializable {
/**
* Create a {@link Collection Collection} wrapping
@@ -92,7 +90,13 @@
* <code>null</code>.
*/
public static Collection wrap(IntCollection collection) {
- return null == collection ? null : new IntCollectionCollection(collection);
+ if(null == collection) {
+ return null;
+ } else if(collection instanceof Serializable) {
+ return new IntCollectionCollection(collection);
+ } else {
+ return new NonSerializableIntCollectionCollection(collection);
+ }
}
/**
@@ -110,111 +114,10 @@
_collection = collection;
}
- public boolean add(Object element) {
- return _collection.add(((Number)element).intValue());
- }
- public boolean addAll(Collection c) {
- return _collection.addAll(CollectionIntCollection.wrap(c));
+ protected IntCollection getIntCollection() {
+ return _collection;
}
- public void clear() {
- _collection.clear();
- }
-
- public boolean contains(Object element) {
- return _collection.contains(((Number)element).intValue());
- }
-
-
- public boolean containsAll(Collection c) {
- return _collection.containsAll(CollectionIntCollection.wrap(c));
- }
-
- /**
- * If <i>that</i> is a {@link Collection Collection},
- * it is {@link CollectionIntCollection#wrap wrapped} and
- * compared to my underlying
- * {@link org.apache.commons.collections.primitives.IntCollection IntCollection},
- * otherwise this method simply delegates to my underlying
- * <code>IntCollection</code>.
- */
- public boolean equals(Object that) {
- if(that instanceof Collection) {
- try {
- return _collection.equals(CollectionIntCollection.wrap((Collection)that));
- } catch(ClassCastException e) {
- return false;
- } catch(NullPointerException e) {
- return false;
- }
- } else {
- return _collection.equals(that);
- }
- }
-
- public int hashCode() {
- return _collection.hashCode();
- }
-
- public String toString() {
- return _collection.toString();
- }
-
- public boolean isEmpty() {
- return _collection.isEmpty();
- }
-
- /**
- * {@link IntIteratorIterator#wrap wraps} the
- * {@link org.apache.commons.collections.primitives.IntIterator IntIterator}
- * returned by my underlying
- * {@link IntCollection IntCollection},
- * if any.
- */
- public Iterator iterator() {
- return IntIteratorIterator.wrap(_collection.iterator());
- }
-
- public boolean remove(Object element) {
- return _collection.removeElement(((Number)element).intValue());
- }
-
- public boolean removeAll(Collection c) {
- return _collection.removeAll(CollectionIntCollection.wrap(c));
- }
-
- public boolean retainAll(Collection c) {
- return _collection.retainAll(CollectionIntCollection.wrap(c));
- }
-
- public int size() {
- return _collection.size();
- }
-
- public Object[] toArray() {
- int[] a = _collection.toArray();
- Object[] A = new Object[a.length];
- for(int i=0;i<a.length;i++) {
- A[i] = new Integer(a[i]);
- }
- return A;
- }
-
- public Object[] toArray(Object[] A) {
- int[] a = _collection.toArray();
- if(A.length < a.length) {
- A = (Object[])(Array.newInstance(A.getClass().getComponentType(), a.length));
- }
- for(int i=0;i<a.length;i++) {
- A[i] = new Integer(a[i]);
- }
- if(A.length > a.length) {
- A[a.length] = null;
- }
-
- return A;
- }
-
private IntCollection _collection = null;
}
1.5 +13 -86 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListList.java
Index: IntListList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/IntListList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- IntListList.java 26 Feb 2003 19:17:23 -0000 1.4
+++ IntListList.java 28 Feb 2003 21:21:51 -0000 1.5
@@ -58,10 +58,7 @@
package org.apache.commons.collections.primitives.adapters;
import java.io.Serializable;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.apache.commons.collections.primitives.IntList;
@@ -77,7 +74,7 @@
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
-public class IntListList extends IntCollectionCollection implements List, Serializable {
+final public class IntListList extends AbstractIntListList implements Serializable {
/**
* Create a {@link List List} wrapping
@@ -92,7 +89,13 @@
* <code>null</code>.
*/
public static List wrap(IntList list) {
- return null == list ? null : new IntListList(list);
+ if(null == list) {
+ return null;
+ } else if(list instanceof Serializable) {
+ return new IntListList(list);
+ } else {
+ return new NonSerializableIntListList(list);
+ }
}
/**
@@ -107,88 +110,12 @@
* @see #wrap
*/
public IntListList(IntList list) {
- super(list);
_list = list;
}
- public void add(int index, Object element) {
- _list.add(index,((Number)element).intValue());
- }
-
- public boolean addAll(int index, Collection c) {
- return _list.addAll(index,CollectionIntCollection.wrap(c));
- }
-
- public Object get(int index) {
- return new Integer(_list.get(index));
- }
-
- public int indexOf(Object element) {
- return _list.indexOf(((Number)element).intValue());
- }
-
- public int lastIndexOf(Object element) {
- return _list.lastIndexOf(((Number)element).intValue());
- }
-
- /**
- * {@link IntListIteratorListIterator#wrap wraps} the
- * {@link org.apache.commons.collections.primitives.IntListIterator IntListIterator}
- * returned by my underlying
- * {@link IntList IntList},
- * if any.
- */
- public ListIterator listIterator() {
- return IntListIteratorListIterator.wrap(_list.listIterator());
- }
-
- /**
- * {@link IntListIteratorListIterator#wrap wraps} the
- * {@link org.apache.commons.collections.primitives.IntListIterator IntListIterator}
- * returned by my underlying
- * {@link IntList IntList},
- * if any.
- */
- public ListIterator listIterator(int index) {
- return IntListIteratorListIterator.wrap(_list.listIterator(index));
- }
-
- public Object remove(int index) {
- return new Integer(_list.removeElementAt(index));
- }
-
- public Object set(int index, Object element) {
- return new Integer(_list.set(index, ((Number)element).intValue() ));
- }
-
- public List subList(int fromIndex, int toIndex) {
- return IntListList.wrap(_list.subList(fromIndex,toIndex));
- }
-
- public boolean equals(Object obj) {
- if(obj instanceof List) {
- List that = (List)obj;
- if(this == that) {
- return true;
- } else if(this.size() != that.size()) {
- return false;
- } else {
- Iterator thisiter = iterator();
- Iterator thatiter = that.iterator();
- while(thisiter.hasNext()) {
- Object thiselt = thisiter.next();
- Object thatelt = thatiter.next();
- if(null == thiselt ? null != thatelt : !(thiselt.equals(thatelt))) {
- return false;
- }
- }
- return true;
- }
- } else {
- return false;
- }
- }
+ protected IntList getIntList() {
+ return _list;
+ }
private IntList _list = null;
-
}
1.2 +3 -3 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableCollectionIntCollection.java
Index: NonSerializableCollectionIntCollection.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableCollectionIntCollection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NonSerializableCollectionIntCollection.java 28 Feb 2003 00:17:53 -0000 1.1
+++ NonSerializableCollectionIntCollection.java 28 Feb 2003 21:21:51 -0000 1.2
@@ -64,7 +64,7 @@
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
-class NonSerializableCollectionIntCollection extends AbstractCollectionIntCollection {
+final class NonSerializableCollectionIntCollection extends AbstractCollectionIntCollection {
public NonSerializableCollectionIntCollection(Collection collection) {
_collection = collection;
}
1.2 +3 -3 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableListIntList.java
Index: NonSerializableListIntList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableListIntList.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NonSerializableListIntList.java 28 Feb 2003 00:17:53 -0000 1.1
+++ NonSerializableListIntList.java 28 Feb 2003 21:21:51 -0000 1.2
@@ -65,7 +65,7 @@
* @version $Revision$ $Date$
* @author Rodney Waldhoff
*/
-class NonSerializableListIntList extends AbstractListIntList {
+final class NonSerializableListIntList extends AbstractListIntList {
protected NonSerializableListIntList(List list) {
_list = list;
1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/AbstractIntCollectionCollection.java
Index: AbstractIntCollectionCollection.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/AbstractIntCollectionCollection.java,v 1.1 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.primitives.adapters;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Iterator;
import org.apache.commons.collections.primitives.IntCollection;
/**
* @since Commons Collections 2.2
* @version $Revision: 1.1 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
abstract class AbstractIntCollectionCollection implements Collection {
public boolean add(Object element) {
return getIntCollection().add(((Number)element).intValue());
}
public boolean addAll(Collection c) {
return getIntCollection().addAll(CollectionIntCollection.wrap(c));
}
public void clear() {
getIntCollection().clear();
}
public boolean contains(Object element) {
return getIntCollection().contains(((Number)element).intValue());
}
public boolean containsAll(Collection c) {
return getIntCollection().containsAll(CollectionIntCollection.wrap(c));
}
public String toString() {
return getIntCollection().toString();
}
public boolean isEmpty() {
return getIntCollection().isEmpty();
}
/**
* {@link IntIteratorIterator#wrap wraps} the
* {@link org.apache.commons.collections.primitives.IntIterator IntIterator}
* returned by my underlying
* {@link IntCollection IntCollection},
* if any.
*/
public Iterator iterator() {
return IntIteratorIterator.wrap(getIntCollection().iterator());
}
public boolean remove(Object element) {
return getIntCollection().removeElement(((Number)element).intValue());
}
public boolean removeAll(Collection c) {
return getIntCollection().removeAll(CollectionIntCollection.wrap(c));
}
public boolean retainAll(Collection c) {
return getIntCollection().retainAll(CollectionIntCollection.wrap(c));
}
public int size() {
return getIntCollection().size();
}
public Object[] toArray() {
int[] a = getIntCollection().toArray();
Object[] A = new Object[a.length];
for(int i=0;i<a.length;i++) {
A[i] = new Integer(a[i]);
}
return A;
}
public Object[] toArray(Object[] A) {
int[] a = getIntCollection().toArray();
if(A.length < a.length) {
A = (Object[])(Array.newInstance(A.getClass().getComponentType(), a.length));
}
for(int i=0;i<a.length;i++) {
A[i] = new Integer(a[i]);
}
if(A.length > a.length) {
A[a.length] = null;
}
return A;
}
protected abstract IntCollection getIntCollection();
}
1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/AbstractIntListList.java
Index: AbstractIntListList.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/AbstractIntListList.java,v 1.1 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.primitives.adapters;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.apache.commons.collections.primitives.IntCollection;
import org.apache.commons.collections.primitives.IntList;
/**
* @since Commons Collections 2.2
* @version $Revision: 1.1 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
abstract class AbstractIntListList extends AbstractIntCollectionCollection implements List {
public void add(int index, Object element) {
getIntList().add(index,((Number)element).intValue());
}
public boolean addAll(int index, Collection c) {
return getIntList().addAll(index,CollectionIntCollection.wrap(c));
}
public Object get(int index) {
return new Integer(getIntList().get(index));
}
public int indexOf(Object element) {
return getIntList().indexOf(((Number)element).intValue());
}
public int lastIndexOf(Object element) {
return getIntList().lastIndexOf(((Number)element).intValue());
}
/**
* {@link IntListIteratorListIterator#wrap wraps} the
* {@link org.apache.commons.collections.primitives.IntListIterator IntListIterator}
* returned by my underlying
* {@link IntList IntList},
* if any.
*/
public ListIterator listIterator() {
return IntListIteratorListIterator.wrap(getIntList().listIterator());
}
/**
* {@link IntListIteratorListIterator#wrap wraps} the
* {@link org.apache.commons.collections.primitives.IntListIterator IntListIterator}
* returned by my underlying
* {@link IntList IntList},
* if any.
*/
public ListIterator listIterator(int index) {
return IntListIteratorListIterator.wrap(getIntList().listIterator(index));
}
public Object remove(int index) {
return new Integer(getIntList().removeElementAt(index));
}
public Object set(int index, Object element) {
return new Integer(getIntList().set(index, ((Number)element).intValue() ));
}
public List subList(int fromIndex, int toIndex) {
return IntListList.wrap(getIntList().subList(fromIndex,toIndex));
}
public boolean equals(Object obj) {
if(obj instanceof List) {
List that = (List)obj;
if(this == that) {
return true;
} else if(this.size() != that.size()) {
return false;
} else {
Iterator thisiter = iterator();
Iterator thatiter = that.iterator();
while(thisiter.hasNext()) {
Object thiselt = thisiter.next();
Object thatelt = thatiter.next();
if(null == thiselt ? null != thatelt : !(thiselt.equals(thatelt))) {
return false;
}
}
return true;
}
} else {
return false;
}
}
public int hashCode() {
return getIntList().hashCode();
}
protected final IntCollection getIntCollection() {
return getIntList();
}
protected abstract IntList getIntList();
}
1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableIntCollectionCollection.java
Index: NonSerializableIntCollectionCollection.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableIntCollectionCollection.java,v 1.1 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.primitives.adapters;
import org.apache.commons.collections.primitives.IntCollection;
/**
* @since Commons Collections 2.2
* @version $Revision: 1.1 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
final class NonSerializableIntCollectionCollection extends AbstractIntCollectionCollection {
/**
* Creates a {@link Collection Collection} wrapping
* the specified {@link IntCollection IntCollection}.
*/
public NonSerializableIntCollectionCollection(IntCollection collection) {
_collection = collection;
}
protected IntCollection getIntCollection() {
return _collection;
}
private IntCollection _collection = null;
}
1.1 jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableIntListList.java
Index: NonSerializableIntListList.java
===================================================================
/*
* $Header: /home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/primitives/adapters/NonSerializableIntListList.java,v 1.1 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.collections.primitives.adapters;
import org.apache.commons.collections.primitives.IntList;
/**
* @since Commons Collections 2.2
* @version $Revision: 1.1 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
final class NonSerializableIntListList extends AbstractIntListList {
/**
* Creates a {@link List List} wrapping
* the specified {@link IntList IntList}.
*/
public NonSerializableIntListList(IntList list) {
_list = list;
}
protected IntList getIntList() {
return _list;
}
private IntList _list = null;
}
1.10 +17 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayIntList.java
Index: TestArrayIntList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayIntList.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestArrayIntList.java 28 Feb 2003 00:17:53 -0000 1.9
+++ TestArrayIntList.java 28 Feb 2003 21:21:51 -0000 1.10
@@ -76,8 +76,7 @@
}
public static Test suite() {
- // BulkTests won't work, sublists are not serializable
- TestSuite suite = new TestSuite(TestArrayIntList.class);
+ TestSuite suite = BulkTest.makeSuite(TestArrayIntList.class);
return suite;
}
@@ -86,6 +85,20 @@
protected IntList makeEmptyIntList() {
return new ArrayIntList();
+ }
+
+ public String[] ignoredSimpleTests() {
+ // sublists are not serializable
+ return new String[] {
+ "TestArrayIntList.bulkTestSubList.testFullListSerialization",
+ "TestArrayIntList.bulkTestSubList.testEmptyListSerialization",
+ "TestArrayIntList.bulkTestSubList.testCanonicalEmptyCollectionExists",
+ "TestArrayIntList.bulkTestSubList.testCanonicalFullCollectionExists",
+ "TestArrayIntList.bulkTestSubList.testEmptyListCompatibility",
+ "TestArrayIntList.bulkTestSubList.testFullListCompatibility",
+ "TestArrayIntList.bulkTestSubList.testSerializeDeserializeThenCompare",
+ "TestArrayIntList.bulkTestSubList.testSimpleSerialization"
+ };
}
// tests
1.10 +18 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedShortList.java
Index: TestArrayUnsignedShortList.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/primitives/TestArrayUnsignedShortList.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestArrayUnsignedShortList.java 28 Feb 2003 00:17:53 -0000 1.9
+++ TestArrayUnsignedShortList.java 28 Feb 2003 21:21:51 -0000 1.10
@@ -76,8 +76,8 @@
}
public static Test suite() {
- // BulkTests won't work, sublists are not serializable
- return new TestSuite(TestArrayUnsignedShortList.class);
+ TestSuite suite = BulkTest.makeSuite(TestArrayUnsignedShortList.class);
+ return suite;
}
// collections testing framework
@@ -85,6 +85,20 @@
protected IntList makeEmptyIntList() {
return new ArrayUnsignedShortList();
+ }
+
+ public String[] ignoredSimpleTests() {
+ // sublists are not serializable
+ return new String[] {
+ "TestArrayUnsignedShortList.bulkTestSubList.testFullListSerialization",
+ "TestArrayUnsignedShortList.bulkTestSubList.testEmptyListSerialization",
+ "TestArrayUnsignedShortList.bulkTestSubList.testCanonicalEmptyCollectionExists",
+ "TestArrayUnsignedShortList.bulkTestSubList.testCanonicalFullCollectionExists",
+ "TestArrayUnsignedShortList.bulkTestSubList.testEmptyListCompatibility",
+ "TestArrayUnsignedShortList.bulkTestSubList.testFullListCompatibility",
+ "TestArrayUnsignedShortList.bulkTestSubList.testSerializeDeserializeThenCompare",
+ "TestArrayUnsignedShortList.bulkTestSubList.testSimpleSerialization"
+ };
}
// tests
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org