org.norther.tammi.acorn.util
Class ModifiableCollection<E>

java.lang.Object
  extended by org.norther.tammi.acorn.util.UnmodifiableCollection<E>
      extended by org.norther.tammi.acorn.util.ModifiableCollection<E>
Type Parameters:
E - the element type.
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Modifiable

public class ModifiableCollection<E>
extends UnmodifiableCollection<E>
implements Modifiable

Extends UnmodifiableCollection by supporting modifications after cloning.

Version:
$Id: ModifiableCollection.java,v 1.14 2009/09/28 15:08:48 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.norther.tammi.acorn.util.Modifiable
MODIFIABLE_ADAPTEE, MODIFIABLE_ADAPTER, MODIFIABLE_COLLECTION, MODIFIABLE_MASK
 
Constructor Summary
ModifiableCollection(boolean... modifiable)
          Constructs an empty collection.
ModifiableCollection(Collection<E> c, boolean... modifiable)
          Constructs a new collection.
 
Method Summary
 boolean add(E o)
           
 boolean addAll(Collection<? extends E> x)
           
 void clear()
           
 Object clone()
           
protected  Collection<E> getModifiableCollection(boolean... modifiable)
          Gets a modifiable instance of the wrapped collection.
 boolean isModifiable()
          Checks whether this collection is modifiable.
 Iterator<E> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> x)
           
 boolean retainAll(Collection<?> x)
           
protected  void setCollection(Collection<E> c)
          Sets the collection adaptee.
 
Methods inherited from class org.norther.tammi.acorn.util.UnmodifiableCollection
contains, containsAll, equals, getCollection, hashCode, isEmpty, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ModifiableCollection

public ModifiableCollection(boolean... modifiable)
Constructs an empty collection.

Parameters:
modifiable - the modifiable states of the collection, adapter and adaptee.

ModifiableCollection

public ModifiableCollection(Collection<E> c,
                            boolean... modifiable)
Constructs a new collection.

Parameters:
c - a collection to wrap.
modifiable - the modifiable states of the collection, adapter and adaptee.
Method Detail

clone

public Object clone()
Overrides:
clone in class UnmodifiableCollection<E>

isModifiable

public boolean isModifiable()
Description copied from interface: Modifiable
Checks whether this collection is modifiable.

Specified by:
isModifiable in interface Modifiable
Returns:
true for a modifiable collection, false otherwise.

add

public boolean add(E o)
Specified by:
add in interface Collection<E>
Overrides:
add in class UnmodifiableCollection<E>

addAll

public boolean addAll(Collection<? extends E> x)
Specified by:
addAll in interface Collection<E>
Overrides:
addAll in class UnmodifiableCollection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Overrides:
clear in class UnmodifiableCollection<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Overrides:
iterator in class UnmodifiableCollection<E>

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Overrides:
remove in class UnmodifiableCollection<E>

removeAll

public boolean removeAll(Collection<?> x)
Specified by:
removeAll in interface Collection<E>
Overrides:
removeAll in class UnmodifiableCollection<E>

retainAll

public boolean retainAll(Collection<?> x)
Specified by:
retainAll in interface Collection<E>
Overrides:
retainAll in class UnmodifiableCollection<E>

setCollection

protected void setCollection(Collection<E> c)
Description copied from class: UnmodifiableCollection
Sets the collection adaptee.

Overrides:
setCollection in class UnmodifiableCollection<E>
Parameters:
c - the wrapped collection.

getModifiableCollection

protected Collection<E> getModifiableCollection(boolean... modifiable)
Gets a modifiable instance of the wrapped collection.

Parameters:
modifiable - the modifiable states of the collection, adapter and adaptee.
Returns:
a modifiable collection or null.


Copyright © 2004 The Norther Organization. All rights reserved.