rwaldhoff 2003/10/27 15:46:11
Added: primitives/src/java/org/apache/commons/collections/primitives
LongCollections.java
primitives/src/java/org/apache/commons/collections/primitives/decorators
BaseProxyLongList.java UnmodifiableLongList.java
ProxyLongListIterator.java ProxyLongIterator.java
UnmodifiableLongIterator.java
UnmodifiableLongListIterator.java
NonSerializableUnmodifiableLongList.java
BaseProxyLongCollection.java
BaseUnmodifiableLongList.java
Log:
add LongCollections and related classes
Revision Changes Path
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/LongCollections.java
Index: LongCollections.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/LongCollections.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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 LongERRUPTION) 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;
import org.apache.commons.collections.primitives.decorators.UnmodifiableLongIterator;
import org.apache.commons.collections.primitives.decorators.UnmodifiableLongList;
import
org.apache.commons.collections.primitives.decorators.UnmodifiableLongListIterator;
/**
* This class consists exclusively of static methods that operate on or
* return LongCollections.
* <p>
* The methods of this class all throw a NullPoLongerException if the
* provided collection is null.
*
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
public final class LongCollections {
/**
* Returns an unmodifiable LongList containing only the specified element.
* @param value the single value
* @return an unmodifiable LongList containing only the specified element.
*/
public static LongList singletonLongList(long value) {
// TODO: a specialized implementation of LongList may be more performant
LongList list = new ArrayLongList(1);
list.add(value);
return UnmodifiableLongList.wrap(list);
}
/**
* Returns an unmodifiable LongIterator containing only the specified element.
* @param value the single value
* @return an unmodifiable LongIterator containing only the specified element.
*/
public static LongIterator singletonLongIterator(long value) {
return singletonLongList(value).iterator();
}
/**
* Returns an unmodifiable LongListIterator containing only the specified
element.
* @param value the single value
* @return an unmodifiable LongListIterator containing only the specified
element.
*/
public static LongListIterator singletonLongListIterator(long value) {
return singletonLongList(value).listIterator();
}
/**
* Returns an unmodifiable version of the given non-null LongList.
* @param list the non-null LongList to wrap in an unmodifiable decorator
* @return an unmodifiable version of the given non-null LongList
* @throws NullPoLongerException if the given LongList is null
* @see
org.apache.commons.collections.primitives.decorators.UnmodifiableLongList#wrap
*/
public static LongList unmodifiableLongList(LongList list) throws
NullPointerException {
if(null == list) {
throw new NullPointerException();
}
return UnmodifiableLongList.wrap(list);
}
/**
* Returns an unmodifiable version of the given non-null LongIterator.
* @param iter the non-null LongIterator to wrap in an unmodifiable decorator
* @return an unmodifiable version of the given non-null LongIterator
* @throws NullPoLongerException if the given LongIterator is null
* @see
org.apache.commons.collections.primitives.decorators.UnmodifiableLongIterator#wrap
*/
public static LongIterator unmodifiableLongIterator(LongIterator iter) {
if(null == iter) {
throw new NullPointerException();
}
return UnmodifiableLongIterator.wrap(iter);
}
/**
* Returns an unmodifiable version of the given non-null LongListIterator.
* @param iter the non-null LongListIterator to wrap in an unmodifiable decorator
* @return an unmodifiable version of the given non-null LongListIterator
* @throws NullPoLongerException if the given LongListIterator is null
* @see
org.apache.commons.collections.primitives.decorators.UnmodifiableLongListIterator#wrap
*/
public static LongListIterator unmodifiableLongListIterator(LongListIterator
iter) {
if(null == iter) {
throw new NullPointerException();
}
return UnmodifiableLongListIterator.wrap(iter);
}
/**
* Returns an unmodifiable, empty LongList.
* @return an unmodifiable, empty LongList.
* @see #EMPTY_LONG_LIST
*/
public static LongList getEmptyLongList() {
return EMPTY_LONG_LIST;
}
/**
* Returns an unmodifiable, empty LongIterator
* @return an unmodifiable, empty LongIterator.
* @see #EMPTY_LONG_ITERATOR
*/
public static LongIterator getEmptyLongIterator() {
return EMPTY_LONG_ITERATOR;
}
/**
* Returns an unmodifiable, empty LongListIterator
* @return an unmodifiable, empty LongListIterator.
* @see #EMPTY_LONG_LIST_ITERATOR
*/
public static LongListIterator getEmptyLongListIterator() {
return EMPTY_LONG_LIST_ITERATOR;
}
/**
* An unmodifiable, empty LongList
* @see #getEmptyLongList
*/
public static final LongList EMPTY_LONG_LIST = unmodifiableLongList(new
ArrayLongList(0));
/**
* An unmodifiable, empty LongIterator
* @see #getEmptyLongIterator
*/
public static final LongIterator EMPTY_LONG_ITERATOR =
unmodifiableLongIterator(EMPTY_LONG_LIST.iterator());
/**
* An unmodifiable, empty LongListIterator
* @see #getEmptyLongListIterator
*/
public static final LongListIterator EMPTY_LONG_LIST_ITERATOR =
unmodifiableLongListIterator(EMPTY_LONG_LIST.listIterator());
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/BaseProxyLongList.java
Index: BaseProxyLongList.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/BaseProxyLongList.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongCollection;
import org.apache.commons.collections.primitives.LongList;
import org.apache.commons.collections.primitives.LongListIterator;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
abstract class BaseProxyLongList extends BaseProxyLongCollection implements LongList
{
protected abstract LongList getProxiedList();
protected final LongCollection getProxiedCollection() {
return getProxiedList();
}
protected BaseProxyLongList() {
}
public void add(int index, long element) {
getProxiedList().add(index,element);
}
public boolean addAll(int index, LongCollection collection) {
return getProxiedList().addAll(index,collection);
}
public long get(int index) {
return getProxiedList().get(index);
}
public int indexOf(long element) {
return getProxiedList().indexOf(element);
}
public int lastIndexOf(long element) {
return getProxiedList().lastIndexOf(element);
}
public LongListIterator listIterator() {
return getProxiedList().listIterator();
}
public LongListIterator listIterator(int index) {
return getProxiedList().listIterator(index);
}
public long removeElementAt(int index) {
return getProxiedList().removeElementAt(index);
}
public long set(int index, long element) {
return getProxiedList().set(index,element);
}
public LongList subList(int fromIndex, int toIndex) {
return getProxiedList().subList(fromIndex,toIndex);
}
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableLongList.java
Index: UnmodifiableLongList.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableLongList.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import java.io.Serializable;
import org.apache.commons.collections.primitives.LongList;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
public final class UnmodifiableLongList extends BaseUnmodifiableLongList implements
Serializable {
UnmodifiableLongList(LongList list) {
this.proxied = list;
}
public static final LongList wrap(LongList list) {
if(null == list) {
return null;
} else if(list instanceof UnmodifiableLongList) {
return list;
} else if(list instanceof Serializable) {
return new UnmodifiableLongList(list);
} else {
return new NonSerializableUnmodifiableLongList(list);
}
}
protected LongList getProxiedList() {
return proxied;
}
private LongList proxied = null;
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/ProxyLongListIterator.java
Index: ProxyLongListIterator.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/ProxyLongListIterator.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongIterator;
import org.apache.commons.collections.primitives.LongListIterator;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
abstract class ProxyLongListIterator extends ProxyLongIterator implements
LongListIterator {
ProxyLongListIterator() {
}
public boolean hasPrevious() {
return getListIterator().hasPrevious();
}
public int nextIndex() {
return getListIterator().nextIndex();
}
public long previous() {
return getListIterator().previous();
}
public int previousIndex() {
return getListIterator().previousIndex();
}
protected final LongIterator getIterator() {
return getListIterator();
}
protected abstract LongListIterator getListIterator();
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/ProxyLongIterator.java
Index: ProxyLongIterator.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/ProxyLongIterator.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongIterator;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
abstract class ProxyLongIterator implements LongIterator {
ProxyLongIterator() {
}
public boolean hasNext() {
return getIterator().hasNext();
}
public long next() {
return getIterator().next();
}
protected abstract LongIterator getIterator();
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableLongIterator.java
Index: UnmodifiableLongIterator.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableLongIterator.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongIterator;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
public final class UnmodifiableLongIterator extends ProxyLongIterator {
UnmodifiableLongIterator(LongIterator iterator) {
this.proxied = iterator;
}
public void remove() {
throw new UnsupportedOperationException("This LongIterator is not
modifiable.");
}
protected LongIterator getIterator() {
return proxied;
}
public static final LongIterator wrap(LongIterator iterator) {
if(null == iterator) {
return null;
} else if(iterator instanceof UnmodifiableLongIterator) {
return iterator;
} else {
return new UnmodifiableLongIterator(iterator);
}
}
private LongIterator proxied = null;
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableLongListIterator.java
Index: UnmodifiableLongListIterator.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/UnmodifiableLongListIterator.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongListIterator;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
public final class UnmodifiableLongListIterator extends ProxyLongListIterator {
UnmodifiableLongListIterator(LongListIterator iterator) {
this.proxied = iterator;
}
public void remove() {
throw new UnsupportedOperationException("This LongListIterator is not
modifiable.");
}
public void add(long value) {
throw new UnsupportedOperationException("This LongListIterator is not
modifiable.");
}
public void set(long value) {
throw new UnsupportedOperationException("This LongListIterator is not
modifiable.");
}
protected LongListIterator getListIterator() {
return proxied;
}
public static final LongListIterator wrap(LongListIterator iterator) {
if(null == iterator) {
return null;
} else if(iterator instanceof UnmodifiableLongListIterator) {
return iterator;
} else {
return new UnmodifiableLongListIterator(iterator);
}
}
private LongListIterator proxied = null;
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/NonSerializableUnmodifiableLongList.java
Index: NonSerializableUnmodifiableLongList.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/NonSerializableUnmodifiableLongList.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongList;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
final class NonSerializableUnmodifiableLongList extends BaseUnmodifiableLongList {
NonSerializableUnmodifiableLongList(LongList list) {
this.proxied = list;
}
protected LongList getProxiedList() {
return proxied;
}
private LongList proxied = null;
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/BaseProxyLongCollection.java
Index: BaseProxyLongCollection.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/BaseProxyLongCollection.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongCollection;
import org.apache.commons.collections.primitives.LongIterator;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
abstract class BaseProxyLongCollection implements LongCollection {
protected abstract LongCollection getProxiedCollection();
protected BaseProxyLongCollection() {
}
public boolean add(long element) {
return getProxiedCollection().add(element);
}
public boolean addAll(LongCollection c) {
return getProxiedCollection().addAll(c);
}
public void clear() {
getProxiedCollection().clear();
}
public boolean contains(long element) {
return getProxiedCollection().contains(element);
}
public boolean containsAll(LongCollection c) {
return getProxiedCollection().containsAll(c);
}
public boolean isEmpty() {
return getProxiedCollection().isEmpty();
}
public LongIterator iterator() {
return getProxiedCollection().iterator();
}
public boolean removeAll(LongCollection c) {
return getProxiedCollection().removeAll(c);
}
public boolean removeElement(long element) {
return getProxiedCollection().removeElement(element);
}
public boolean retainAll(LongCollection c) {
return getProxiedCollection().retainAll(c);
}
public int size() {
return getProxiedCollection().size();
}
public long[] toArray() {
return getProxiedCollection().toArray();
}
public long[] toArray(long[] a) {
return getProxiedCollection().toArray(a);
}
// TODO: Add note about possible contract violations here.
public boolean equals(Object obj) {
return getProxiedCollection().equals(obj);
}
public int hashCode() {
return getProxiedCollection().hashCode();
}
public String toString() {
return getProxiedCollection().toString();
}
}
1.1
jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/BaseUnmodifiableLongList.java
Index: BaseUnmodifiableLongList.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons/primitives/src/java/org/apache/commons/collections/primitives/decorators/BaseUnmodifiableLongList.java,v
1.1 2003/10/27 23:46:10 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 acknowledgement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgement may appear in the software itself,
* if and wherever such third-party acknowledgements 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 [EMAIL PROTECTED]
*
* 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.decorators;
import org.apache.commons.collections.primitives.LongCollection;
import org.apache.commons.collections.primitives.LongIterator;
import org.apache.commons.collections.primitives.LongList;
import org.apache.commons.collections.primitives.LongListIterator;
/**
*
* @since Commons Primitives 1.0
* @version $Revision: 1.1 $ $Date: 2003/10/27 23:46:10 $
*
* @author Rodney Waldhoff
*/
abstract class BaseUnmodifiableLongList extends BaseProxyLongList {
public final void add(int index, long element) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final boolean addAll(int index, LongCollection collection) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final long removeElementAt(int index) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final long set(int index, long element) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final boolean add(long element) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final boolean addAll(LongCollection c) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final void clear() {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final boolean removeAll(LongCollection c) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final boolean removeElement(long element) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final boolean retainAll(LongCollection c) {
throw new UnsupportedOperationException("This LongList is not modifiable.");
}
public final LongList subList(int fromIndex, int toIndex) {
return
UnmodifiableLongList.wrap(getProxiedList().subList(fromIndex,toIndex));
}
public final LongIterator iterator() {
return UnmodifiableLongIterator.wrap(getProxiedList().iterator());
}
public LongListIterator listIterator() {
return UnmodifiableLongListIterator.wrap(getProxiedList().listIterator());
}
public LongListIterator listIterator(int index) {
return
UnmodifiableLongListIterator.wrap(getProxiedList().listIterator(index));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]