diff --git a/src/java/org/apache/commons/collections/ArrayEnumeration.java b/src/java/org/apache/commons/collections/ArrayEnumeration.java deleted file mode 100644 index 1a648f289..000000000 --- a/src/java/org/apache/commons/collections/ArrayEnumeration.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/ArrayEnumeration.java,v 1.5 2002/06/12 03:59:15 mas Exp $ - * $Revision: 1.5 $ - * $Date: 2002/06/12 03:59:15 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.Enumeration; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * Enumeration wrapper for array. - * - * @since 1.0 - * @author Peter Donald - * @deprecated This class has significant overlap with ArrayIterator, - * and Collections focuses mainly on Java2-style - * collections. If you need to enumerate an array, - * create an {@link ArrayIterator} and wrap it with an - * {@link IteratorEnumeration} instead. - */ -public final class ArrayEnumeration - implements Enumeration -{ - protected Object[] m_elements; - protected int m_index; - - public ArrayEnumeration( final List elements ) - { - m_elements = elements.toArray(); - } - - public ArrayEnumeration( final Object[] elements ) - { - if(elements == null) { - m_elements = new Object[0]; - } else { - m_elements = elements; - } - } - - public boolean hasMoreElements() - { - return ( m_index < m_elements.length ); - } - - public Object nextElement() - { - if( !hasMoreElements() ) - { - throw new NoSuchElementException("No more elements exist"); - } - - return m_elements[ m_index++ ]; - } -} - diff --git a/src/java/org/apache/commons/collections/ArrayIterator.java b/src/java/org/apache/commons/collections/ArrayIterator.java deleted file mode 100644 index 0f8607a29..000000000 --- a/src/java/org/apache/commons/collections/ArrayIterator.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/ArrayIterator.java,v 1.17 2002/10/12 22:15:19 scolebourne Exp $ - * $Revision: 1.17 $ - * $Date: 2002/10/12 22:15:19 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - - -/** Implements an {@link java.util.Iterator} over an array of objects. - * - * @since 1.0 - * @author James Strachan - * @author Mauricio S. Moura - * @author Michael A. Smith - * @version $Revision: 1.17 $ - * @deprecated this class has been moved to the iterators subpackage - */ -public class ArrayIterator -extends org.apache.commons.collections.iterators.ArrayIterator { - - /** - * Construct an ArrayIterator. Using this constructor, the iterator is - * equivalent to an empty iterator until {@link #setArray(Object)} is - * called to establish the array to iterate over. - **/ - public ArrayIterator() { - super(); - } - - /** - * Construct an ArrayIterator that will iterate over the values in the - * specified array. - * - * @param array the array to iterate over. - * - * @exception IllegalArgumentException if array is not an - * array. - * - * @exception NullPointerException - * if array is null - **/ - public ArrayIterator(Object array) { - super(array); - } - - /** - * Construct an ArrayIterator that will iterate over the values in the - * specified array. - * - * @param array the array to iterate over. - * @param start the index to start iterating at. - * - * @exception IllegalArgumentException if array is not an - * array. - * - * @exception NullPointerException - * if array is null - **/ - public ArrayIterator(Object array, int start) { - super(array, start); - } - - /** - * Construct an ArrayIterator that will iterate over the values in the - * specified array. - * - * @param array the array to iterate over. - * @param start the index to start iterating at. - * @param end the index to finish iterating at. - * - * @exception IllegalArgumentException if array is not an - * array. - * - * @exception NullPointerException - * if array is null - **/ - public ArrayIterator(Object array, int start, int end) { - super(array, start, end); - } - -} diff --git a/src/java/org/apache/commons/collections/EnumerationIterator.java b/src/java/org/apache/commons/collections/EnumerationIterator.java deleted file mode 100644 index 99ab68ad0..000000000 --- a/src/java/org/apache/commons/collections/EnumerationIterator.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/EnumerationIterator.java,v 1.7 2002/10/12 22:15:18 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:18 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.Collection; -import java.util.Enumeration; - -/** Adapter to make {@link Enumeration Enumeration} instances appear - * to be {@link java.util.Iterator Iterator} instances. - * - * @since 1.0 - * @author James Strachan - * @author Daniel Rall - * @deprecated this class has been moved to the iterators subpackage - */ -public class EnumerationIterator -extends org.apache.commons.collections.iterators.EnumerationIterator { - - /** - * Constructs a new EnumerationIterator that will not - * function until {@link #setEnumeration(Enumeration)} is called. - */ - public EnumerationIterator() { - super(); - } - - /** - * Constructs a new EnumerationIterator that provides - * an iterator view of the given enumeration. - * - * @param enumeration the enumeration to use - */ - public EnumerationIterator( Enumeration enumeration ) { - super(enumeration); - } - - /** - * Constructs a new EnumerationIterator that will remove - * elements from the specified collection. - * - * @param enum the enumeration to use - * @param collection the collection to remove elements form - */ - public EnumerationIterator( Enumeration enum, Collection collection ) { - super(enum, collection); - } - -} diff --git a/src/java/org/apache/commons/collections/FilterIterator.java b/src/java/org/apache/commons/collections/FilterIterator.java deleted file mode 100644 index acdf65547..000000000 --- a/src/java/org/apache/commons/collections/FilterIterator.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/FilterIterator.java,v 1.8 2002/10/12 22:15:18 scolebourne Exp $ - * $Revision: 1.8 $ - * $Date: 2002/10/12 22:15:18 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.Iterator; - -/** A Proxy {@link Iterator Iterator} which takes a {@link Predicate Predicate} instance to filter - * out objects from an underlying {@link Iterator Iterator} instance. - * Only objects for which the - * specified Predicate evaluates to true are - * returned. - * - * @since 1.0 - * @author James Strachan - * @author Jan Sorensen - * @deprecated this class has been moved to the iterators subpackage - */ - -public class FilterIterator -extends org.apache.commons.collections.iterators.FilterIterator { - - /** - * Constructs a new FilterIterator that will not function - * until {@link #setIterator(Iterator) setIterator} is invoked. - */ - public FilterIterator() { - super(); - } - - /** - * Constructs a new FilterIterator that will not function - * until {@link #setPredicate(Predicate) setPredicate} is invoked. - * - * @param iterator the iterator to use - */ - public FilterIterator( Iterator iterator ) { - super( iterator ); - } - - /** - * Constructs a new FilterIterator that will use the - * given iterator and predicate. - * - * @param iterator the iterator to use - * @param predicate the predicate to use - */ - public FilterIterator( Iterator iterator, Predicate predicate ) { - super( iterator, predicate ); - } - -} diff --git a/src/java/org/apache/commons/collections/FilterListIterator.java b/src/java/org/apache/commons/collections/FilterListIterator.java deleted file mode 100644 index dc7d4be23..000000000 --- a/src/java/org/apache/commons/collections/FilterListIterator.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/FilterListIterator.java,v 1.7 2002/10/12 22:15:18 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:18 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.ListIterator; - -/** - * A proxy {@link ListIterator ListIterator} which - * takes a {@link Predicate Predicate} instance to filter - * out objects from an underlying ListIterator - * instance. Only objects for which the specified - * Predicate evaluates to true are - * returned by the iterator. - * - * @since 2.0 - * @version $Revision: 1.7 $ $Date: 2002/10/12 22:15:18 $ - * @author Rodney Waldhoff - * @deprecated this class has been moved to the iterators subpackage - */ -public class FilterListIterator -extends org.apache.commons.collections.iterators.FilterListIterator { - - // Constructors - //------------------------------------------------------------------------- - - /** - * Constructs a new FilterListIterator that will not - * function until - * {@link ProxyListIterator#setListIterator(ListIterator) setListIterator} - * and {@link #setPredicate(Predicate) setPredicate} are invoked. - */ - public FilterListIterator() { - super(); - } - - /** - * Constructs a new FilterListIterator that will not - * function until {@link #setPredicate(Predicate) setPredicate} is invoked. - * - * @param iterator the iterator to use - */ - public FilterListIterator(ListIterator iterator ) { - super(iterator); - } - - /** - * Constructs a new FilterListIterator. - * - * @param iterator the iterator to use - * @param predicate the predicate to use - */ - public FilterListIterator(ListIterator iterator, Predicate predicate) { - super(iterator, predicate); - } - - /** - * Constructs a new FilterListIterator that will not - * function until - * {@link ProxyListIterator#setListIterator(ListIterator) setListIterator} - * is invoked. - * - * @param predicate the predicate to use. - */ - public FilterListIterator(Predicate predicate) { - super(predicate); - } - -} diff --git a/src/java/org/apache/commons/collections/IteratorEnumeration.java b/src/java/org/apache/commons/collections/IteratorEnumeration.java deleted file mode 100644 index 1b5541db5..000000000 --- a/src/java/org/apache/commons/collections/IteratorEnumeration.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/IteratorEnumeration.java,v 1.7 2002/10/12 22:15:18 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:18 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.Iterator; - -/** Adapter to make an {@link Iterator Iterator} instance appear to be an {@link java.util.Enumeration Enumeration} instances - * - * @since 1.0 - * @author James Strachan - * @deprecated this class has been moved to the iterators subpackage - */ - -public class IteratorEnumeration -extends org.apache.commons.collections.iterators.IteratorEnumeration { - - /** - * Constructs a new IteratorEnumeration that will not - * function until {@link #setIterator(Iterator) setIterator} is - * invoked. - */ - public IteratorEnumeration() { - super(); - } - - /** - * Constructs a new IteratorEnumeration that will use - * the given iterator. - * - * @param iterator the iterator to use - */ - public IteratorEnumeration( Iterator iterator ) { - super(iterator); - } - - -} diff --git a/src/java/org/apache/commons/collections/ProxyIterator.java b/src/java/org/apache/commons/collections/ProxyIterator.java deleted file mode 100644 index b9133a4f5..000000000 --- a/src/java/org/apache/commons/collections/ProxyIterator.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/ProxyIterator.java,v 1.6 2002/08/15 23:13:51 pjack Exp $ - * $Revision: 1.6 $ - * $Date: 2002/08/15 23:13:51 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.Iterator; - -/** A Proxy {@link Iterator Iterator} which delegates its methods to a proxy instance. - * - * @since 1.0 - * @see ProxyListIterator - * @version $Revision: 1.6 $ $Date: 2002/08/15 23:13:51 $ - * - * @author James Strachan - * @deprecated this class has been moved to the iterators subpackage - */ - -public class ProxyIterator -extends org.apache.commons.collections.iterators.ProxyIterator { - - /** - * Constructs a new ProxyIterator that will not function - * until {@link #setIterator(Iterator)} is called. - */ - public ProxyIterator() { - super(); - } - - /** - * Constructs a new ProxyIterator that will use the - * given iterator. - * - * @param iterator the underyling iterator - */ - public ProxyIterator( Iterator iterator ) { - super(iterator); - } - -} diff --git a/src/java/org/apache/commons/collections/ProxyListIterator.java b/src/java/org/apache/commons/collections/ProxyListIterator.java deleted file mode 100644 index fcf9f57c5..000000000 --- a/src/java/org/apache/commons/collections/ProxyListIterator.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/ProxyListIterator.java,v 1.4 2002/08/15 23:13:51 pjack Exp $ - * $Revision: 1.4 $ - * $Date: 2002/08/15 23:13:51 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.ListIterator; - -/** - * A proxy {@link ListIterator ListIterator} which delegates its - * methods to a proxy instance. - * - * @since 2.0 - * @see ProxyIterator - * @version $Revision: 1.4 $ $Date: 2002/08/15 23:13:51 $ - * @author Rodney Waldhoff - * @deprecated this class has been moved to the iterators subpackage - */ -public class ProxyListIterator -extends org.apache.commons.collections.iterators.ProxyListIterator { - - // Constructor - //------------------------------------------------------------------------- - - /** - * Constructs a new ProxyListIterator that will not - * function until {@link #setListIterator(ListIterator) setListIterator} - * is invoked. - */ - public ProxyListIterator() { - super(); - } - - /** - * Constructs a new ProxyListIterator that will use the - * given list iterator. - * - * @param iterator the list iterator to use - */ - public ProxyListIterator(ListIterator iterator) { - super(iterator); - } - -} - diff --git a/src/java/org/apache/commons/collections/SingletonIterator.java b/src/java/org/apache/commons/collections/SingletonIterator.java deleted file mode 100644 index e69035b20..000000000 --- a/src/java/org/apache/commons/collections/SingletonIterator.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/SingletonIterator.java,v 1.8 2002/10/12 22:15:18 scolebourne Exp $ - * $Revision: 1.8 $ - * $Date: 2002/10/12 22:15:18 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - - - -/**

SingletonIterator is an {@link java.util.Iterator Iterator} over a single - * object instance.

- * - * @since 2.0 - * @author James Strachan - * @version $Revision: 1.8 $ - * @deprecated this class has been moved to the iterators subpackage - */ -public class SingletonIterator -extends org.apache.commons.collections.iterators.SingletonIterator { - - /** - * Constructs a new SingletonIterator. - * - * @param object the single object to return from the iterator - */ - public SingletonIterator(Object object) { - super(object); - } - -} diff --git a/src/java/org/apache/commons/collections/SoftRefHashMap.java b/src/java/org/apache/commons/collections/SoftRefHashMap.java deleted file mode 100644 index 2466ba364..000000000 --- a/src/java/org/apache/commons/collections/SoftRefHashMap.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/SoftRefHashMap.java,v 1.7 2002/11/24 17:30:15 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/11/24 17:30:15 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.lang.ref.Reference; -import java.lang.ref.SoftReference; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -/**

- * HashMap with SoftReference links to values which allows the values of the Map - * to be garbage collected by the JVM if it becomes low on memory. - * Derive from this class and - * override the factory method createReference() method to make - * a Map wrapped in other types of Reference. - *

- * - *

- * A synchronized version can be obtained with: - * Collections.synchronizedMap( theMapToSynchronize ) - *

- * - *

- * WARNING the values() and entrySet() methods require optimisation - * like the standard {@link HashMap} implementations so that iteration - * over this Map is efficient. - *

- * - * @since 1.0 - * @author James.Dodd - * @author James Strachan - * @deprecated This class is all kinds of wonky; use ReferenceMap instead. - * @see - * Bug#9571 - */ -public class SoftRefHashMap implements Map { - - /** The wrapped HashMap */ - private Map hashMap = new HashMap(); - - - public SoftRefHashMap() { - } - - - /** - * Removes References that have had their referents garbage collected - */ - public void purge() { - Map map = getMap(); - Set keys = map.keySet(); - if ( keys == null ) { - return; - } - for ( Iterator i = keys.iterator(); i.hasNext(); ) { - Object key = (Object) i.next(); - Reference ref = (Reference) map.get( key ); - if ( ref.get() == null ) { - i.remove(); - } - } - } - - // Map implementation - // ------------------------------------------------------- - - /** - * Retrieves the referent of the Referenced value - * @param key The key with which to retrieve the value - */ - public Object get( final Object key ) { - Reference ref = (Reference) getMap().get( key ); - if ( ref == null ) { - return null; - } - return ref.get(); - } - - /** - * Adds a key-value mapping, wrapping the value in a Reference - */ - public Object put( final Object key, final Object value ) { - Object answer = getMap().put( key, createReference( value ) ); - if ( answer != null ) { - return ((Reference) answer).get(); - } - return null; - } - - /** - * Returns a collection of the Referenced values - */ - public Collection values() { - Set wrappedValues = (Set) getMap().values(); - Set values = new TreeSet(); - if ( wrappedValues == null ) { - return values; - } - for ( Iterator i = wrappedValues.iterator(); i.hasNext(); ) { - Reference ref = (Reference) i.next(); - if ( ref != null ) { - values.add( ref.get() ); - } - } - return values; - } - - /** - * Answers whether the argument is in the domain of the mappings - */ - public boolean containsKey( Object key ) { - return getMap().containsKey( key ); - } - - /** - * Answers whether the argument is a Referenced value - */ - public boolean containsValue( Object value ) { - Collection values = (Collection) getMap().values(); - if ( values == null ) { - return false; - } - for ( Iterator i = values.iterator(); i.hasNext(); ) { - Reference ref = (Reference) i.next(); - if ( ref == null ) { - continue; - } - Object target = ref.get(); - if ( target == value ) { - return true; - } - } - return false; - } - - /** - * Put all of the mappings in the argument into this wrapped map - */ - public void putAll( final java.util.Map map ) { - if ( map == null || map.size() == 0 ) { - return; - } - for ( Iterator i = map.keySet().iterator(); i.hasNext(); ) { - Object key = (Object) i.next(); - put( key, map.get( key ) ); - } - } - - /** - * Returns a set view of the mappings in the wrapped map - */ - public Set entrySet() { - Set entries = new HashSet(); - if ( size() == 0 ) { - return entries; - } - for ( Iterator i = keySet().iterator(); i.hasNext(); ) { - Object key = i.next(); - Object value = get( key ); - Entry entry = new Entry( key, value ); - entries.add( entry ); - } - return entries; - } - - /** - * Removes a mapping from this map - */ - public Object remove( final Object key ) { - Reference ref = (Reference) getMap().remove( key ); - if ( ref != null ) { - return ref.get(); - } - return null; - } - - /** - * Clears all mappings - */ - public void clear() { - getMap().clear(); - } - - /** - * Calculates the hash code for this map - */ - public int hashCode() { - return getMap().hashCode(); - } - - /** - * Returns the domain of the mappings - */ - public Set keySet() { - return getMap().keySet(); - } - - /** - * Answers whether there are any mappings - */ - public boolean isEmpty() { - return getMap().isEmpty(); - } - - /** - * Answers whether this map and the argument are 'the same' - */ - public boolean equals( final Object object ) { - return getMap().equals( object ); - } - - /** - * Returns the number of mappings in this map - */ - public int size() { - return getMap().size(); - } - - // Inner Classes - // --------------------------------------------------------------------- - - /** - * A map entry, which is backed by this RefHashMap - */ - class Entry implements Map.Entry { - - /** - * Constructor - */ - public Entry( Object key, Object value ) { - this.key = key; - this.value = value; - } - - // Map.Entry interface - // ----------------------------------------------------------- - - /** - * Retrieves the key of this mapping - */ - public Object getKey() { - return key; - } - - /** - * Retrieves the value of this mapping - */ - public Object getValue() { - return value; - } - - /** - * Sets the value of this mapping - */ - public Object setValue( Object value ) { - this.value = value; - put( key, value ); - return value; - } - - /** - * Return the hash code of this mapping. - * This algorithm was taken from the JavaDoc for Map.Entry - */ - public int hashCode() { - return ( getKey() == null ? 0 : getKey().hashCode() ) ^ - ( getValue() == null ? 0 : getValue().hashCode() ); - } - - /** The domain of this mapping */ - private Object key; - /** The range of this mapping */ - private Object value; - } - - /** - * Returns a reference to the argument. - * Override this method to make wrapped maps for other Reference types - */ - protected Reference createReference( Object referent ) { - return new SoftReference( referent ); - } - - /** - * Retrieves the wrapped HashMap - * @return The wrapped HashMap - */ - protected Map getMap() { - return hashMap; - } -} diff --git a/src/java/org/apache/commons/collections/StringStack.java b/src/java/org/apache/commons/collections/StringStack.java deleted file mode 100644 index b81a9079c..000000000 --- a/src/java/org/apache/commons/collections/StringStack.java +++ /dev/null @@ -1,266 +0,0 @@ -package org.apache.commons.collections; - -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 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 "Apache" and "Apache Software Foundation" and - * "Apache Turbine" 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", - * "Apache Turbine", nor may "Apache" appear in their name, 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 - * . - */ - -import java.io.Serializable; -import java.util.Iterator; -import java.util.Stack; -/** - * This class implements a stack for String objects. - *

- * This class provides a way to collect a list of unique strings and join - * them with an optional separator. - * - * @deprecated This class is not a Stack, it is a String utility. As such - * it is deprecated in favour of the StringUtils class in - * the [lang] project. - * @since 2.0 - * @author John D. McNally - * @author Daniel Rall - * @author Stephen Colebourne - * @version $Id: StringStack.java,v 1.3 2002/10/13 11:17:57 scolebourne Exp $ - */ -public class StringStack implements Serializable -{ - /** - * The stack of String objects. - */ - private Stack stack = null; - - /** - * Creates an empty instance. - */ - public StringStack() - { - stack = new Stack(); - } - - /** - * Adds the String to the collection if it does not already - * contain it. - * - * @param s The String object to add to this stack - * (if it is not null and doesn't already exist in - * the stack). - * @return A reference to this stack (useful for when this method - * is called repeatedly). - */ - public StringStack add(String s) - { - if (s != null && !contains(s)) - { - stack.push(s); - } - return this; - } - - /** - * Adds all Strings in the given StringStack to the collection - * (skipping those it already contains) - * - * @param ss The stack of String objects to add to - * this stack (if it is not null and doesn't already - * exist in the stack). - * @return A reference to this stack (useful for when this method - * is called repeatedly). - */ - public StringStack addAll(StringStack ss) - { - Iterator i = ss.stack.iterator(); - while (i.hasNext()) - { - add((String) i.next()); - } - return this; - } - - /** - * Clears the stack. - */ - public void clear() - { - stack.clear(); - } - - /** - * Returns whether this stack contain the specified text. - * - * @param s The text to search for. - * @return Whether the stack contains the text. - */ - public boolean contains(String s) - { - return (stack.search(s) != -1); - } - - /** - * Whether the stack is empty. - * - * @return Whether the stack is empty. - */ - public final boolean empty() - { - return stack.empty(); - } - - /** - * Get a string off the stack at a certain position. - * - * @param i The position. - * @return A the string from the specified position. - */ - public String get(int i) - { - return (String) stack.elementAt(i); - } - - /** - * Returns the size of the stack. - * - * @return The size of the stack. - */ - public final int size() - { - return stack.size(); - } - - /** - * Converts the stack to a single {@link java.lang.String} with no - * separator. - * - * @return The stack elements as a single block of text. - */ - public String toString() - { - return toString(""); - } - - /** - * Converts the stack to a single {@link java.lang.String}. - * - * @param separator The text to use as glue between elements in - * the stack. - * @return The stack elements--glued together by - * separator--as a single block of text. - */ - public String toString( String separator ) - { - String s; - if (size() > 0) - { - if ( separator == null ) - { - separator = ""; - } - - // Determine what size to pre-allocate for the buffer. - int totalSize = 0; - for (int i = 0; i < stack.size(); i++) - { - totalSize += get(i).length(); - } - totalSize += (stack.size() - 1) * separator.length(); - - StringBuffer sb = new StringBuffer(totalSize).append( get(0) ); - for (int i = 1; i < stack.size(); i++) - { - sb.append(separator).append(get(i)); - } - s = sb.toString(); - } - else - { - s = ""; - } - return s; - } - - /** - * Compares two StringStacks. Considered equal if the - * toString() method returns such. - */ - public boolean equals(Object ssbuf) - { - boolean isEquiv = false; - if ( ssbuf == null || !(ssbuf instanceof StringStack) ) - { - isEquiv = false; - } - else if ( ssbuf == this ) - { - isEquiv = true; - } - else if ( this.toString().equals(ssbuf.toString()) ) - { - isEquiv = true; - } - return isEquiv; - } - - /** - * Turns this stack into an array. - * - * @return This stack as an array. - */ - public String[] toStringArray() - { - String[] array = new String[size()]; - for (int i = 0; i < size(); i++) - { - array[i] = get(i); - } - return array; - } -} diff --git a/src/java/org/apache/commons/collections/TransformIterator.java b/src/java/org/apache/commons/collections/TransformIterator.java deleted file mode 100644 index ee553efda..000000000 --- a/src/java/org/apache/commons/collections/TransformIterator.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/Attic/TransformIterator.java,v 1.7 2002/10/12 22:15:18 scolebourne Exp $ - * $Revision: 1.7 $ - * $Date: 2002/10/12 22:15:18 $ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 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 acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements 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 Group. - * - * 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 - * . - * - */ -package org.apache.commons.collections; - -import java.util.Iterator; - -/** A Proxy {@link Iterator Iterator} which uses a {@link Transformer Transformer} instance to - * transform the contents of the {@link Iterator Iterator} into some other form - * - * @since 1.0 - * @author James Strachan - * @deprecated this class has been moved to the iterators subpackage - */ - -public class TransformIterator -extends org.apache.commons.collections.iterators.TransformIterator { - - /** - * Constructs a new TransformIterator that will not function - * until the {@link #setIterator(Iterator) setIterator} method is - * invoked. - */ - public TransformIterator() { - super(); - } - - /** - * Constructs a new TransformIterator that won't transform - * elements from the given iterator. - * - * @param iterator the iterator to use - */ - public TransformIterator( Iterator iterator ) { - super( iterator ); - } - - /** - * Constructs a new TransformIterator that will use the - * given iterator and transformer. If the given transformer is null, - * then objects will not be transformed. - * - * @param iterator the iterator to use - * @param transformer the transformer to use - */ - public TransformIterator( Iterator iterator, Transformer transformer ) { - super( iterator, transformer ); - } - -}