org.multiverse.transactional.collections
Class AbstractTransactionalDeque<E>

java.lang.Object
  extended by org.multiverse.transactional.collections.AbstractTransactionalDeque<E>
Type Parameters:
E -
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.concurrent.BlockingDeque<E>, java.util.concurrent.BlockingQueue<E>, java.util.Deque<E>, java.util.Queue<E>, TransactionalCollection<E>, TransactionalDeque<E>, TransactionalQueue<E>
Direct Known Subclasses:
TransactionalLinkedList

public abstract class AbstractTransactionalDeque<E>
extends java.lang.Object
implements TransactionalDeque<E>

An abtract TransactionalDeque implementation.

Author:
Peter Veentjer.

Constructor Summary
AbstractTransactionalDeque()
           
 
Method Summary
 boolean add(E e)
           
 void addFirst(E e)
           
 void addLast(E e)
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
protected abstract  void doAddFirst(E e)
           
protected abstract  void doAddLast(E e)
           
protected abstract  E doRemoveFirst()
           
protected abstract  E doRemoveLast()
           
 int drainTo(java.util.Collection<? super E> c)
           
 int drainTo(java.util.Collection<? super E> c, int maxElements)
           
 E element()
           
 E getFirst()
           
 E getLast()
           
protected  boolean hasNoStorageCapacity()
           
 boolean isEmpty()
           
abstract  java.util.Iterator<E> iterator()
          Returns an iterator over the elements contained in this collection.
 boolean offer(E e)
           
 boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit)
           
 boolean offerFirst(E e)
           
 boolean offerFirst(E e, long timeout, java.util.concurrent.TimeUnit unit)
           
 boolean offerLast(E e)
           
 boolean offerLast(E e, long timeout, java.util.concurrent.TimeUnit unit)
           
 E peek()
           
 E poll()
           
 E poll(long timeout, java.util.concurrent.TimeUnit unit)
           
 E pollFirst()
           
 E pollFirst(long timeout, java.util.concurrent.TimeUnit unit)
           
 E pollLast()
           
 E pollLast(long timeout, java.util.concurrent.TimeUnit unit)
           
 E pop()
           
 void push(E e)
           
 void put(E e)
           
 void putFirst(E e)
           
 void putLast(E e)
           
 E remove()
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection<?> c)
           
 E removeFirst()
           
 boolean removeFirstOccurrence(java.lang.Object o)
           
 E removeLast()
           
 boolean removeLastOccurrence(java.lang.Object o)
           
 boolean retainAll(java.util.Collection<?> c)
           
abstract  int size()
           
 E take()
           
 E takeFirst()
           
 E takeLast()
           
 E takeUninterruptible()
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.multiverse.transactional.collections.TransactionalQueue
remainingCapacity
 
Methods inherited from interface org.multiverse.transactional.collections.TransactionalCollection
addAll, atomicSize, clear, equals, hashCode
 
Methods inherited from interface java.util.Deque
descendingIterator, peekFirst, peekLast
 

Constructor Detail

AbstractTransactionalDeque

public AbstractTransactionalDeque()
Method Detail

hasNoStorageCapacity

protected boolean hasNoStorageCapacity()

add

public boolean add(E e)
Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.concurrent.BlockingDeque<E>
Specified by:
add in interface java.util.concurrent.BlockingQueue<E>
Specified by:
add in interface java.util.Deque<E>
Specified by:
add in interface java.util.Queue<E>
Specified by:
add in interface TransactionalCollection<E>

addFirst

public void addFirst(E e)
Specified by:
addFirst in interface java.util.concurrent.BlockingDeque<E>
Specified by:
addFirst in interface java.util.Deque<E>
Specified by:
addFirst in interface TransactionalDeque<E>

doAddFirst

protected abstract void doAddFirst(E e)

addLast

public void addLast(E e)
Specified by:
addLast in interface java.util.concurrent.BlockingDeque<E>
Specified by:
addLast in interface java.util.Deque<E>
Specified by:
addLast in interface TransactionalDeque<E>

offerFirst

public boolean offerFirst(E e)
Specified by:
offerFirst in interface java.util.concurrent.BlockingDeque<E>
Specified by:
offerFirst in interface java.util.Deque<E>
Specified by:
offerFirst in interface TransactionalDeque<E>

offerLast

public boolean offerLast(E e)
Specified by:
offerLast in interface java.util.concurrent.BlockingDeque<E>
Specified by:
offerLast in interface java.util.Deque<E>
Specified by:
offerLast in interface TransactionalDeque<E>

offerFirst

public boolean offerFirst(E e,
                          long timeout,
                          java.util.concurrent.TimeUnit unit)
                   throws java.lang.InterruptedException
Specified by:
offerFirst in interface java.util.concurrent.BlockingDeque<E>
Specified by:
offerFirst in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

offerLast

public boolean offerLast(E e,
                         long timeout,
                         java.util.concurrent.TimeUnit unit)
                  throws java.lang.InterruptedException
Specified by:
offerLast in interface java.util.concurrent.BlockingDeque<E>
Specified by:
offerLast in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

doAddLast

protected abstract void doAddLast(E e)

putFirst

public void putFirst(E e)
              throws java.lang.InterruptedException
Specified by:
putFirst in interface java.util.concurrent.BlockingDeque<E>
Specified by:
putFirst in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

putLast

public void putLast(E e)
             throws java.lang.InterruptedException
Specified by:
putLast in interface java.util.concurrent.BlockingDeque<E>
Specified by:
putLast in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

takeFirst

public E takeFirst()
            throws java.lang.InterruptedException
Specified by:
takeFirst in interface java.util.concurrent.BlockingDeque<E>
Specified by:
takeFirst in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

doRemoveFirst

protected abstract E doRemoveFirst()

takeLast

public E takeLast()
           throws java.lang.InterruptedException
Specified by:
takeLast in interface java.util.concurrent.BlockingDeque<E>
Specified by:
takeLast in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

doRemoveLast

protected abstract E doRemoveLast()

removeFirst

public E removeFirst()
Specified by:
removeFirst in interface java.util.Deque<E>

removeLast

public E removeLast()
Specified by:
removeLast in interface java.util.Deque<E>

removeFirstOccurrence

public boolean removeFirstOccurrence(java.lang.Object o)
Specified by:
removeFirstOccurrence in interface java.util.concurrent.BlockingDeque<E>
Specified by:
removeFirstOccurrence in interface java.util.Deque<E>
Specified by:
removeFirstOccurrence in interface TransactionalDeque<E>

removeLastOccurrence

public boolean removeLastOccurrence(java.lang.Object o)
Specified by:
removeLastOccurrence in interface java.util.concurrent.BlockingDeque<E>
Specified by:
removeLastOccurrence in interface java.util.Deque<E>
Specified by:
removeLastOccurrence in interface TransactionalDeque<E>

offer

public boolean offer(E e)
Specified by:
offer in interface java.util.concurrent.BlockingDeque<E>
Specified by:
offer in interface java.util.concurrent.BlockingQueue<E>
Specified by:
offer in interface java.util.Deque<E>
Specified by:
offer in interface java.util.Queue<E>
Specified by:
offer in interface TransactionalQueue<E>

put

public void put(E e)
         throws java.lang.InterruptedException
Specified by:
put in interface java.util.concurrent.BlockingDeque<E>
Specified by:
put in interface java.util.concurrent.BlockingQueue<E>
Specified by:
put in interface TransactionalQueue<E>
Throws:
java.lang.InterruptedException

remove

public E remove()
Specified by:
remove in interface java.util.concurrent.BlockingDeque<E>
Specified by:
remove in interface java.util.Deque<E>
Specified by:
remove in interface java.util.Queue<E>
Specified by:
remove in interface TransactionalQueue<E>

poll

public E poll()
Specified by:
poll in interface java.util.concurrent.BlockingDeque<E>
Specified by:
poll in interface java.util.Deque<E>
Specified by:
poll in interface java.util.Queue<E>
Specified by:
poll in interface TransactionalQueue<E>

pollFirst

public E pollFirst()
Specified by:
pollFirst in interface java.util.Deque<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<E>
Specified by:
isEmpty in interface TransactionalCollection<E>

pollLast

public E pollLast()
Specified by:
pollLast in interface java.util.Deque<E>

pollFirst

public E pollFirst(long timeout,
                   java.util.concurrent.TimeUnit unit)
            throws java.lang.InterruptedException
Specified by:
pollFirst in interface java.util.concurrent.BlockingDeque<E>
Specified by:
pollFirst in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

pollLast

public E pollLast(long timeout,
                  java.util.concurrent.TimeUnit unit)
           throws java.lang.InterruptedException
Specified by:
pollLast in interface java.util.concurrent.BlockingDeque<E>
Specified by:
pollLast in interface TransactionalDeque<E>
Throws:
java.lang.InterruptedException

offer

public boolean offer(E e,
                     long timeout,
                     java.util.concurrent.TimeUnit unit)
              throws java.lang.InterruptedException
Specified by:
offer in interface java.util.concurrent.BlockingDeque<E>
Specified by:
offer in interface java.util.concurrent.BlockingQueue<E>
Specified by:
offer in interface TransactionalQueue<E>
Throws:
java.lang.InterruptedException

poll

public E poll(long timeout,
              java.util.concurrent.TimeUnit unit)
       throws java.lang.InterruptedException
Specified by:
poll in interface java.util.concurrent.BlockingDeque<E>
Specified by:
poll in interface java.util.concurrent.BlockingQueue<E>
Specified by:
poll in interface TransactionalQueue<E>
Throws:
java.lang.InterruptedException

take

public E take()
       throws java.lang.InterruptedException
Specified by:
take in interface java.util.concurrent.BlockingDeque<E>
Specified by:
take in interface java.util.concurrent.BlockingQueue<E>
Specified by:
take in interface TransactionalQueue<E>
Throws:
java.lang.InterruptedException

takeUninterruptible

public E takeUninterruptible()

element

public E element()
Specified by:
element in interface java.util.concurrent.BlockingDeque<E>
Specified by:
element in interface java.util.Deque<E>
Specified by:
element in interface java.util.Queue<E>
Specified by:
element in interface TransactionalQueue<E>

peek

public E peek()
Specified by:
peek in interface java.util.concurrent.BlockingDeque<E>
Specified by:
peek in interface java.util.Deque<E>
Specified by:
peek in interface java.util.Queue<E>
Specified by:
peek in interface TransactionalQueue<E>

push

public void push(E e)
Specified by:
push in interface java.util.concurrent.BlockingDeque<E>
Specified by:
push in interface java.util.Deque<E>

drainTo

public int drainTo(java.util.Collection<? super E> c)
Specified by:
drainTo in interface java.util.concurrent.BlockingQueue<E>
Specified by:
drainTo in interface TransactionalQueue<E>

drainTo

public int drainTo(java.util.Collection<? super E> c,
                   int maxElements)
Specified by:
drainTo in interface java.util.concurrent.BlockingQueue<E>
Specified by:
drainTo in interface TransactionalQueue<E>

pop

public E pop()
Specified by:
pop in interface java.util.Deque<E>

getFirst

public E getFirst()
Specified by:
getFirst in interface java.util.Deque<E>

getLast

public E getLast()
Specified by:
getLast in interface java.util.Deque<E>

iterator

public abstract java.util.Iterator<E> iterator()
Returns an iterator over the elements contained in this collection.

Specified by:
iterator in interface java.lang.Iterable<E>
Specified by:
iterator in interface java.util.Collection<E>
Specified by:
iterator in interface java.util.concurrent.BlockingDeque<E>
Specified by:
iterator in interface java.util.Deque<E>
Specified by:
iterator in interface TransactionalCollection<E>
Returns:
an iterator over the elements contained in this collection

size

public abstract int size()
Specified by:
size in interface java.util.Collection<E>
Specified by:
size in interface java.util.concurrent.BlockingDeque<E>
Specified by:
size in interface java.util.Deque<E>
Specified by:
size in interface TransactionalCollection<E>

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<E>
Specified by:
contains in interface java.util.concurrent.BlockingDeque<E>
Specified by:
contains in interface java.util.concurrent.BlockingQueue<E>
Specified by:
contains in interface java.util.Deque<E>
Specified by:
contains in interface TransactionalCollection<E>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface TransactionalCollection<E>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface java.util.Collection<E>
Specified by:
toArray in interface TransactionalCollection<E>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<E>
Specified by:
remove in interface java.util.concurrent.BlockingDeque<E>
Specified by:
remove in interface java.util.concurrent.BlockingQueue<E>
Specified by:
remove in interface java.util.Deque<E>
Specified by:
remove in interface TransactionalCollection<E>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<E>
Specified by:
containsAll in interface TransactionalCollection<E>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<E>
Specified by:
removeAll in interface TransactionalCollection<E>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<E>
Specified by:
retainAll in interface TransactionalCollection<E>

toString

public java.lang.String toString()
Specified by:
toString in interface TransactionalCollection<E>
Overrides:
toString in class java.lang.Object


Copyright © 2008-2010 Multiverse. All Rights Reserved.