org.decisiondeck.utils.collections
Class OrderDecoratedSet<E>

java.lang.Object
  extended by com.google.common.collect.ForwardingObject
      extended by com.google.common.collect.ForwardingCollection<E>
          extended by com.google.common.collect.ForwardingSet<E>
              extended by org.decisiondeck.utils.collections.OrderDecoratedSet<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class OrderDecoratedSet<E>
extends ForwardingSet<E>


Constructor Summary
OrderDecoratedSet(ExternalOrderingSet<E> order, Set<E> delegate, boolean changeOrder)
           
 
Method Summary
 boolean add(E element)
           
 boolean addAll(Collection<? extends E> collection)
           
 void clear()
           
 Iterator<E> iterator()
           
 boolean remove(Object object)
           
 boolean removeAll(Collection<?> collection)
           
 boolean retainAll(Collection<?> collection)
           
 Object[] toArray()
           
<T> T[]
toArray(T[] array)
           
 
Methods inherited from class com.google.common.collect.ForwardingSet
equals, hashCode
 
Methods inherited from class com.google.common.collect.ForwardingCollection
contains, containsAll, isEmpty, size
 
Methods inherited from class com.google.common.collect.ForwardingObject
toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
contains, containsAll, isEmpty, size
 

Constructor Detail

OrderDecoratedSet

public OrderDecoratedSet(ExternalOrderingSet<E> order,
                         Set<E> delegate,
                         boolean changeOrder)
Parameters:
order - not null.
delegate - writeable.
changeOrder - if false, the given order is considered as containing every objects that may be added or queried in the given delegate set. The order will not be changed. If an object is added to the given set and is not in the order, an IllegalStateException is thrown. If true, when an object is added to this set, it is added as the best one in the given order (override add to modify this behavior), and when removed, it is removed from the given order (override remove and clear to modify this behavior).
Method Detail

add

public boolean add(E element)
Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>
Overrides:
add in class ForwardingCollection<E>

clear

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

remove

public boolean remove(Object object)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Overrides:
remove in class ForwardingCollection<E>

iterator

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

removeAll

public boolean removeAll(Collection<?> collection)
Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>
Overrides:
removeAll in class ForwardingCollection<E>

addAll

public boolean addAll(Collection<? extends E> collection)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>
Overrides:
addAll in class ForwardingCollection<E>

retainAll

public boolean retainAll(Collection<?> collection)
Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>
Overrides:
retainAll in class ForwardingCollection<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>
Overrides:
toArray in class ForwardingCollection<E>

toArray

public <T> T[] toArray(T[] array)
Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>
Overrides:
toArray in class ForwardingCollection<E>


Copyright © 2011. All Rights Reserved.