org.dishevelled.observable.impl
Class ObservableQueueImpl<E>

java.lang.Object
  extended by org.dishevelled.observable.AbstractQueueDecorator<E>
      extended by org.dishevelled.observable.AbstractObservableQueue<E>
          extended by org.dishevelled.observable.impl.ObservableQueueImpl<E>
Type Parameters:
E - queue element type
All Implemented Interfaces:
Iterable<E>, Collection<E>, Queue<E>, ObservableQueue<E>

public class ObservableQueueImpl<E>
extends AbstractObservableQueue<E>

Observable queue decorator that fires empty vetoable queue change events in preXxx methods and empty queue change events in postXxx methods. Observable queue listeners may query the source of the events to determine what may or may not have changed due to the event.

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

Constructor Summary
ObservableQueueImpl(Queue<E> queue)
          Create a new observable decorator for the specified queue.
 
Method Summary
protected  void postAdd(E e)
          Notify subclasses the add method has just been called on the wrapped queue with the specified parameter.
protected  void postAddAll(Collection<? extends E> coll)
          Notify subclasses the addAll method has just been called on the wrapped queue with the specified parameter.
protected  void postClear()
          Notify subclasses the clear method has just been called on the wrapped queue.
protected  void postIteratorRemove()
          Notify subclasses the remove method has just been called on the wrapped queue's iterator.
protected  void postOffer(E e)
          Notify subclasses the offer method has just been called on the wrapped queue with the specified parameter.
protected  void postPoll()
          Notify subclasses the poll method has just been called on the wrapped queue.
protected  void postRemove(Object o)
          Notify subclasses the remove method has just been called on the wrapped queue with the specified parameter.
protected  void postRemoveAll(Collection<?> coll)
          Notify subclasses the removeAll method has just been called on the wrapped queue with the specified parameter.
protected  void postRetainAll(Collection<?> coll)
          Notify subclasses the retainAll method has just been called on the wrapped queue with the specified parameter.
protected  boolean preAdd(E e)
          Notify subclasses the add method is about to be called on the wrapped queue with the specified parameter.
protected  boolean preAddAll(Collection<? extends E> coll)
          Notify subclasses the addAll method is about to be called on the wrapped queue with the specified parameter.
protected  boolean preClear()
          Notify subclasses the clear method is about to be called on the wrapped queue.
protected  boolean preIteratorRemove()
          Notify subclasses the remove method is about to be called on the wrapped queue's iterator.
protected  boolean preOffer(E e)
          Notify subclasses the offer method is about to be called on the wrapped queue with the specified parameter.
protected  boolean prePoll()
          Notify subclasses the poll method is about to be called on the wrapped queue.
protected  boolean preRemove(Object o)
          Notify subclasses the remove method is about to be called on the wrapped queue with the specified parameter.
protected  boolean preRemoveAll(Collection<?> coll)
          Notify subclasses the removeAll method is about to be called on the wrapped queue with the specified parameter.
protected  boolean preRetainAll(Collection<?> coll)
          Notify subclasses the retainAll method is about to be called on the wrapped queue with the specified parameter.
 
Methods inherited from class org.dishevelled.observable.AbstractObservableQueue
add, addAll, addQueueChangeListener, addVetoableQueueChangeListener, clear, fireQueueChanged, fireQueueChanged, fireQueueWillChange, fireQueueWillChange, getObservableQueueChangeSupport, getQueueChangeListenerCount, getQueueChangeListeners, getVetoableQueueChangeListenerCount, getVetoableQueueChangeListeners, iterator, offer, poll, remove, removeAll, removeQueueChangeListener, removeVetoableQueueChangeListener, retainAll
 
Methods inherited from class org.dishevelled.observable.AbstractQueueDecorator
contains, containsAll, element, equals, getQueue, hashCode, isEmpty, peek, remove, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Queue
element, peek, remove
 
Methods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, isEmpty, size, toArray, toArray
 

Constructor Detail

ObservableQueueImpl

public ObservableQueueImpl(Queue<E> queue)
Create a new observable decorator for the specified queue.

Parameters:
queue - queue to decorate, must not be null
Method Detail

preAdd

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

Specified by:
preAdd in class AbstractObservableQueue<E>
Parameters:
e - add method parameter
Returns:
true to proceed with the change

postAdd

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

Specified by:
postAdd in class AbstractObservableQueue<E>
Parameters:
e - add method parameter

preAddAll

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

Specified by:
preAddAll in class AbstractObservableQueue<E>
Parameters:
coll - addAll method parameter
Returns:
true to proceed with the change

postAddAll

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

Specified by:
postAddAll in class AbstractObservableQueue<E>
Parameters:
coll - addAll method parameter

preClear

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

Specified by:
preClear in class AbstractObservableQueue<E>
Returns:
true to proceed with the change

postClear

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

Specified by:
postClear in class AbstractObservableQueue<E>

preRemove

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

Specified by:
preRemove in class AbstractObservableQueue<E>
Parameters:
o - remove method parameter
Returns:
true to proceed with the change

postRemove

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

Specified by:
postRemove in class AbstractObservableQueue<E>
Parameters:
o - remove method parameter

preRemoveAll

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

Specified by:
preRemoveAll in class AbstractObservableQueue<E>
Parameters:
coll - removeAll method parameter
Returns:
true to proceed with the change

postRemoveAll

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

Specified by:
postRemoveAll in class AbstractObservableQueue<E>
Parameters:
coll - removeAll method parameter

preRetainAll

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

Specified by:
preRetainAll in class AbstractObservableQueue<E>
Parameters:
coll - retainAll method parameter
Returns:
true to proceed with the change

postRetainAll

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

Specified by:
postRetainAll in class AbstractObservableQueue<E>
Parameters:
coll - retainAll method parameter

preIteratorRemove

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

Specified by:
preIteratorRemove in class AbstractObservableQueue<E>
Returns:
true to proceed with the change

postIteratorRemove

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

Specified by:
postIteratorRemove in class AbstractObservableQueue<E>

preOffer

protected boolean preOffer(E e)
Notify subclasses the offer method is about to be called on the wrapped queue with the specified parameter. Return true to proceed with the change.

Specified by:
preOffer in class AbstractObservableQueue<E>
Parameters:
e - offer method parameter
Returns:
true to proceed with the change

postOffer

protected void postOffer(E e)
Notify subclasses the offer method has just been called on the wrapped queue with the specified parameter.

Specified by:
postOffer in class AbstractObservableQueue<E>
Parameters:
e - offer method parameter

prePoll

protected boolean prePoll()
Notify subclasses the poll method is about to be called on the wrapped queue. Return true to proceed with the change.

Specified by:
prePoll in class AbstractObservableQueue<E>
Returns:
true to proceed with the change

postPoll

protected void postPoll()
Notify subclasses the poll method has just been called on the wrapped queue.

Specified by:
postPoll in class AbstractObservableQueue<E>


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