better handling of serializablity w.r.t. sublists

make some types final


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130982 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rodney Waldhoff 2003-02-28 21:21:51 +00:00
parent 02687ec175
commit b9fbf5945b
11 changed files with 552 additions and 212 deletions

View File

@ -0,0 +1,154 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/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();
}

View File

@ -0,0 +1,164 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/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();
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/CollectionIntCollection.java,v 1.5 2003/02/28 00:17:53 rwaldhoff Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/CollectionIntCollection.java,v 1.6 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -72,10 +72,10 @@ import org.apache.commons.collections.primitives.IntCollection;
* implementation in the "obvious" way.
*
* @since Commons Collections 2.2
* @version $Revision: 1.5 $ $Date: 2003/02/28 00:17:53 $
* @version $Revision: 1.6 $ $Date: 2003/02/28 21:21:51 $
* @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

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/IntCollectionCollection.java,v 1.4 2003/02/26 19:17:23 rwaldhoff Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/IntCollectionCollection.java,v 1.5 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -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;
@ -74,10 +72,10 @@ import org.apache.commons.collections.primitives.IntCollection;
* implementation in the "obvious" way.
*
* @since Commons Collections 2.2
* @version $Revision: 1.4 $ $Date: 2003/02/26 19:17:23 $
* @version $Revision: 1.5 $ $Date: 2003/02/28 21:21:51 $
* @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 @@ public class IntCollectionCollection implements Collection, Serializable {
* <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 @@ public class IntCollectionCollection implements Collection, Serializable {
_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;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/IntListList.java,v 1.4 2003/02/26 19:17:23 rwaldhoff Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/IntListList.java,v 1.5 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -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;
@ -74,10 +71,10 @@ import org.apache.commons.collections.primitives.IntList;
* implementation in the "obvious" way.
*
* @since Commons Collections 2.2
* @version $Revision: 1.4 $ $Date: 2003/02/26 19:17:23 $
* @version $Revision: 1.5 $ $Date: 2003/02/28 21:21:51 $
* @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 @@ public class IntListList extends IntCollectionCollection implements List, Serial
* <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 @@ public class IntListList extends IntCollectionCollection implements List, Serial
* @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;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/NonSerializableCollectionIntCollection.java,v 1.1 2003/02/28 00:17:53 rwaldhoff Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/NonSerializableCollectionIntCollection.java,v 1.2 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -61,10 +61,10 @@ import java.util.Collection;
/**
* @since Commons Collections 2.2
* @version $Revision: 1.1 $ $Date: 2003/02/28 00:17:53 $
* @version $Revision: 1.2 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
class NonSerializableCollectionIntCollection extends AbstractCollectionIntCollection {
final class NonSerializableCollectionIntCollection extends AbstractCollectionIntCollection {
public NonSerializableCollectionIntCollection(Collection collection) {
_collection = collection;
}

View File

@ -0,0 +1,82 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/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;
}

View File

@ -0,0 +1,83 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/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;
}

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/NonSerializableListIntList.java,v 1.1 2003/02/28 00:17:53 rwaldhoff Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/adapters/Attic/NonSerializableListIntList.java,v 1.2 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -62,10 +62,10 @@ import java.util.List;
/**
*
* @since Commons Collections 2.2
* @version $Revision: 1.1 $ $Date: 2003/02/28 00:17:53 $
* @version $Revision: 1.2 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
class NonSerializableListIntList extends AbstractListIntList {
final class NonSerializableListIntList extends AbstractListIntList {
protected NonSerializableListIntList(List list) {
_list = list;

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayIntList.java,v 1.9 2003/02/28 00:17:53 rwaldhoff Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayIntList.java,v 1.10 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -63,7 +63,7 @@ import junit.framework.TestSuite;
import org.apache.commons.collections.BulkTest;
/**
* @version $Revision: 1.9 $ $Date: 2003/02/28 00:17:53 $
* @version $Revision: 1.10 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
public class TestArrayIntList extends TestIntList {
@ -76,8 +76,7 @@ public class TestArrayIntList extends TestIntList {
}
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;
}
@ -88,6 +87,20 @@ public class TestArrayIntList extends TestIntList {
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
// ------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayUnsignedShortList.java,v 1.9 2003/02/28 00:17:53 rwaldhoff Exp $
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestArrayUnsignedShortList.java,v 1.10 2003/02/28 21:21:51 rwaldhoff Exp $
* ====================================================================
* The Apache Software License, Version 1.1
*
@ -63,7 +63,7 @@ import junit.framework.TestSuite;
import org.apache.commons.collections.BulkTest;
/**
* @version $Revision: 1.9 $ $Date: 2003/02/28 00:17:53 $
* @version $Revision: 1.10 $ $Date: 2003/02/28 21:21:51 $
* @author Rodney Waldhoff
*/
public class TestArrayUnsignedShortList extends TestIntList {
@ -76,8 +76,8 @@ public class TestArrayUnsignedShortList extends TestIntList {
}
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
@ -87,6 +87,20 @@ public class TestArrayUnsignedShortList extends TestIntList {
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
// ------------------------------------------------------------------------