org.dishevelled.observable
Class AbstractObservableSortedSet<E>

java.lang.Object
  extended by org.dishevelled.observable.AbstractSortedSetDecorator<E>
      extended by org.dishevelled.observable.AbstractObservableSortedSet<E>
Type Parameters:
E - sorted set element type
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>, SortedSet<E>, ObservableSortedSet<E>
Direct Known Subclasses:
ObservableSortedSetImpl

public abstract class AbstractObservableSortedSet<E>
extends AbstractSortedSetDecorator<E>
implements ObservableSortedSet<E>

Abstract implementation of an observable sorted set that decorates an instance of SortedSet.

Version:
$Revision$ $Date$
Author:
Michael Heuer

Constructor Summary
protected AbstractObservableSortedSet(SortedSet<E> sortedSet)
          Create a new abstract observable sorted set that decorates the specified sorted set.
 
Method Summary
 boolean add(E e)
          
 boolean addAll(Collection<? extends E> coll)
          
 void addSortedSetChangeListener(SortedSetChangeListener<E> l)
          Add the specified sorted set change listener.
 void addVetoableSortedSetChangeListener(VetoableSortedSetChangeListener<E> l)
          Add the specified vetoable sorted set change listener.
 void clear()
          
 void fireSortedSetChanged()
          Fire a change event to all registered SortedSetChangeListeners.
 void fireSortedSetChanged(SortedSetChangeEvent<E> e)
          Fire the specified change event to all registered SortedSetChangeListeners.
 void fireSortedSetWillChange()
          Fire a will change event to all registered VetoableSortedSetChangeListeners.
 void fireSortedSetWillChange(VetoableSortedSetChangeEvent<E> e)
          Fire the specified will change event to all registered VetoableSortedSetChangeListeners.
protected  ObservableSortedSetChangeSupport<E> getObservableSortedSetChangeSupport()
          Return the ObservableSortedSetChangeSupport class backing this abstract observable sorted set.
 int getSortedSetChangeListenerCount()
          Return the number of SortedSetChangeListeners registered to this observable sorted set.
 SortedSetChangeListener<E>[] getSortedSetChangeListeners()
          Return an array of all SortedSetChangeListeners, or an empty array if none are registered.
 int getVetoableSortedSetChangeListenerCount()
          Return the number of VetoableSortedSetChangeListeners registered to this observable sorted set.
 VetoableSortedSetChangeListener<E>[] getVetoableSortedSetChangeListeners()
          Return an array of all VetoableSortedSetChangeListeners, or an empty array if none are registered.
 Iterator<E> iterator()
          
protected abstract  void postAdd(E e)
          Notify subclasses the add method has just been called on the wrapped sorted set with the specified parameter.
protected abstract  void postAddAll(Collection<? extends E> coll)
          Notify subclasses the addAll method has just been called on the wrapped sorted set with the specified parameter.
protected abstract  void postClear()
          Notify subclasses the clear method has just been called on the wrapped sorted set.
protected abstract  void postIteratorRemove()
          Notify subclasses the remove method has just been called on the wrapped sorted set's iterator.
protected abstract  void postRemove(Object o)
          Notify subclasses the remove method has just been called on the wrapped sorted set with the specified parameter.
protected abstract  void postRemoveAll(Collection<?> coll)
          Notify subclasses the removeAll method has just been called on the wrapped sorted set with the specified parameter.
protected abstract  void postRetainAll(Collection<?> coll)
          Notify subclasses the retainAll method has just been called on the wrapped sorted set with the specified parameter.
protected abstract  boolean preAdd(E e)
          Notify subclasses the add method is about to be called on the wrapped sorted set with the specified parameter.
protected abstract  boolean preAddAll(Collection<? extends E> coll)
          Notify subclasses the addAll method is about to be called on the wrapped sorted set with the specified parameter.
protected abstract  boolean preClear()
          Notify subclasses the clear method is about to be called on the wrapped sorted set.
protected abstract  boolean preIteratorRemove()
          Notify subclasses the remove method is about to be called on the wrapped sorted set's iterator.
protected abstract  boolean preRemove(Object o)
          Notify subclasses the remove method is about to be called on the wrapped sorted set with the specified parameter.
protected abstract  boolean preRemoveAll(Collection<?> coll)
          Notify subclasses the removeAll method is about to be called on the wrapped sorted set with the specified parameter.
protected abstract  boolean preRetainAll(Collection<?> coll)
          Notify subclasses the retainAll method is about to be called on the wrapped sorted set with the specified parameter.
 boolean remove(Object o)
          
 boolean removeAll(Collection<?> coll)
          
 void removeSortedSetChangeListener(SortedSetChangeListener<E> l)
          Remove the specified sorted set change listener.
 void removeVetoableSortedSetChangeListener(VetoableSortedSetChangeListener<E> l)
          Remove the specified vetoable sorted set change listener.
 boolean retainAll(Collection<?> coll)
          
 
Methods inherited from class org.dishevelled.observable.AbstractSortedSetDecorator
comparator, contains, containsAll, equals, first, getSortedSet, hashCode, headSet, isEmpty, last, size, subSet, tailSet, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.SortedSet
comparator, first, headSet, last, subSet, tailSet
 
Methods inherited from interface java.util.Set
contains, containsAll, equals, hashCode, isEmpty, size, toArray, toArray
 

Constructor Detail

AbstractObservableSortedSet

protected AbstractObservableSortedSet(SortedSet<E> sortedSet)
Create a new abstract observable sorted set that decorates the specified sorted set.

Parameters:
sortedSet - sorted set to decorate
Method Detail

getObservableSortedSetChangeSupport

protected final ObservableSortedSetChangeSupport<E> getObservableSortedSetChangeSupport()
Return the ObservableSortedSetChangeSupport class backing this abstract observable sorted set.

Returns:
the ObservableSortedSetChangeSupport class backing this abstract observable sorted set

addSortedSetChangeListener

public final void addSortedSetChangeListener(SortedSetChangeListener<E> l)
Add the specified sorted set change listener.

Specified by:
addSortedSetChangeListener in interface ObservableSortedSet<E>
Parameters:
l - sorted set change listener to add

removeSortedSetChangeListener

public final void removeSortedSetChangeListener(SortedSetChangeListener<E> l)
Remove the specified sorted set change listener.

Specified by:
removeSortedSetChangeListener in interface ObservableSortedSet<E>
Parameters:
l - sorted set change listener to remove

addVetoableSortedSetChangeListener

public final void addVetoableSortedSetChangeListener(VetoableSortedSetChangeListener<E> l)
Add the specified vetoable sorted set change listener.

Specified by:
addVetoableSortedSetChangeListener in interface ObservableSortedSet<E>
Parameters:
l - vetoable sorted set change listener to add

removeVetoableSortedSetChangeListener

public final void removeVetoableSortedSetChangeListener(VetoableSortedSetChangeListener<E> l)
Remove the specified vetoable sorted set change listener.

Specified by:
removeVetoableSortedSetChangeListener in interface ObservableSortedSet<E>
Parameters:
l - vetoable sorted set change listener to remove

getSortedSetChangeListeners

public final SortedSetChangeListener<E>[] getSortedSetChangeListeners()
Return an array of all SortedSetChangeListeners, or an empty array if none are registered.

Specified by:
getSortedSetChangeListeners in interface ObservableSortedSet<E>
Returns:
an array of all SortedSetChangeListeners, or an empty array if none are registered

getSortedSetChangeListenerCount

public final int getSortedSetChangeListenerCount()
Return the number of SortedSetChangeListeners registered to this observable sorted set.

Specified by:
getSortedSetChangeListenerCount in interface ObservableSortedSet<E>
Returns:
the number of SortedSetChangeListeners registered to this observable sorted set

getVetoableSortedSetChangeListeners

public final VetoableSortedSetChangeListener<E>[] getVetoableSortedSetChangeListeners()
Return an array of all VetoableSortedSetChangeListeners, or an empty array if none are registered.

Specified by:
getVetoableSortedSetChangeListeners in interface ObservableSortedSet<E>
Returns:
an array of all VetoableSortedSetChangeListeners, or an empty array if none are registered

getVetoableSortedSetChangeListenerCount

public final int getVetoableSortedSetChangeListenerCount()
Return the number of VetoableSortedSetChangeListeners registered to this observable sorted set.

Specified by:
getVetoableSortedSetChangeListenerCount in interface ObservableSortedSet<E>
Returns:
the number of VetoableSortedSetChangeListeners registered to this observable sorted set

fireSortedSetWillChange

public void fireSortedSetWillChange()
                             throws SortedSetChangeVetoException
Fire a will change event to all registered VetoableSortedSetChangeListeners.

Throws:
SortedSetChangeVetoException - if any of the listeners veto the change

fireSortedSetWillChange

public void fireSortedSetWillChange(VetoableSortedSetChangeEvent<E> e)
                             throws SortedSetChangeVetoException
Fire the specified will change event to all registered VetoableSortedSetChangeListeners.

Parameters:
e - will change event
Throws:
SortedSetChangeVetoException - if any of the listeners veto the change

fireSortedSetChanged

public void fireSortedSetChanged()
Fire a change event to all registered SortedSetChangeListeners.


fireSortedSetChanged

public void fireSortedSetChanged(SortedSetChangeEvent<E> e)
Fire the specified change event to all registered SortedSetChangeListeners.

Parameters:
e - change event

preAdd

protected abstract boolean preAdd(E e)
Notify subclasses the add method is about to be called on the wrapped sorted set with the specified parameter. Return true to proceed with the change.

Parameters:
e - add method parameter
Returns:
true to proceed with the change

postAdd

protected abstract void postAdd(E e)
Notify subclasses the add method has just been called on the wrapped sorted set with the specified parameter.

Parameters:
e - add method parameter

preAddAll

protected abstract boolean preAddAll(Collection<? extends E> coll)
Notify subclasses the addAll method is about to be called on the wrapped sorted set with the specified parameter. Return true to proceed with the change.

Parameters:
coll - addAll method parameter
Returns:
true to proceed with the change

postAddAll

protected abstract void postAddAll(Collection<? extends E> coll)
Notify subclasses the addAll method has just been called on the wrapped sorted set with the specified parameter.

Parameters:
coll - addAll method parameter

preClear

protected abstract boolean preClear()
Notify subclasses the clear method is about to be called on the wrapped sorted set. Return true to proceed with the change.

Returns:
true to proceed with the change

postClear

protected abstract void postClear()
Notify subclasses the clear method has just been called on the wrapped sorted set.


preRemove

protected abstract boolean preRemove(Object o)
Notify subclasses the remove method is about to be called on the wrapped sorted set with the specified parameter. Return true to proceed with the change.

Parameters:
o - remove method parameter
Returns:
true to proceed with the change

postRemove

protected abstract void postRemove(Object o)
Notify subclasses the remove method has just been called on the wrapped sorted set with the specified parameter.

Parameters:
o - remove method parameter

preRemoveAll

protected abstract boolean preRemoveAll(Collection<?> coll)
Notify subclasses the removeAll method is about to be called on the wrapped sorted set with the specified parameter. Return true to proceed with the change.

Parameters:
coll - removeAll method parameter
Returns:
true to proceed with the change

postRemoveAll

protected abstract void postRemoveAll(Collection<?> coll)
Notify subclasses the removeAll method has just been called on the wrapped sorted set with the specified parameter.

Parameters:
coll - removeAll method parameter

preRetainAll

protected abstract boolean preRetainAll(Collection<?> coll)
Notify subclasses the retainAll method is about to be called on the wrapped sorted set with the specified parameter. Return true to proceed with the change.

Parameters:
coll - retainAll method parameter
Returns:
true to proceed with the change

postRetainAll

protected abstract void postRetainAll(Collection<?> coll)
Notify subclasses the retainAll method has just been called on the wrapped sorted set with the specified parameter.

Parameters:
coll - retainAll method parameter

preIteratorRemove

protected abstract boolean preIteratorRemove()
Notify subclasses the remove method is about to be called on the wrapped sorted set's iterator. Return true to proceed with the change.

Returns:
true to proceed with the change

postIteratorRemove

protected abstract void postIteratorRemove()
Notify subclasses the remove method has just been called on the wrapped sorted set's iterator.


add

public boolean add(E e)

Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>
Overrides:
add in class AbstractSortedSetDecorator<E>

addAll

public boolean addAll(Collection<? extends E> coll)

Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>
Overrides:
addAll in class AbstractSortedSetDecorator<E>

clear

public void clear()

Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>
Overrides:
clear in class AbstractSortedSetDecorator<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 AbstractSortedSetDecorator<E>

remove

public boolean remove(Object o)

Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>
Overrides:
remove in class AbstractSortedSetDecorator<E>

removeAll

public boolean removeAll(Collection<?> coll)

Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>
Overrides:
removeAll in class AbstractSortedSetDecorator<E>

retainAll

public boolean retainAll(Collection<?> coll)

Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>
Overrides:
retainAll in class AbstractSortedSetDecorator<E>


Copyright (c) 2003-2012 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).