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

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

public abstract class AbstractTransactionalDeque<E>
extends 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(Object o)
           
 boolean containsAll(Collection<?> c)
           
protected abstract  void doAddFirst(E e)
           
protected abstract  void doAddLast(E e)
           
protected abstract  E doRemoveFirst()
           
protected abstract  E doRemoveLast()
           
 int drainTo(Collection<? super E> c)
           
 int drainTo(Collection<? super E> c, int maxElements)
           
 E element()
           
 E getFirst()
           
 E getLast()
           
protected  boolean hasNoStorageCapacity()
           
 boolean isEmpty()
           
abstract  Iterator<E> iterator()
          Returns an iterator over the elements contained in this collection.
 boolean offer(E e)
           
 boolean offer(E e, long timeout, TimeUnit unit)
           
 boolean offerFirst(E e)
           
 boolean offerFirst(E e, long timeout, TimeUnit unit)
           
 boolean offerLast(E e)
           
 boolean offerLast(E e, long timeout, TimeUnit unit)
           
 E peek()
           
 E poll()
           
 E poll(long timeout, TimeUnit unit)
           
 E pollFirst()
           
 E pollFirst(long timeout, TimeUnit unit)
           
 E pollLast()
           
 E pollLast(long timeout, TimeUnit unit)
           
 E pop()
           
 void push(E e)
           
 void put(E e)
           
 void putFirst(E e)
           
 void putLast(E e)
           
 E remove()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 E removeFirst()
           
 boolean removeFirstOccurrence(Object o)
           
 E removeLast()
           
 boolean removeLastOccurrence(Object o)
           
 boolean retainAll(Collection<?> c)
           
abstract  int size()
           
 E take()
           
 E takeFirst()
           
 E takeLast()
           
 E takeUninterruptible()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 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 Collection<E>
Specified by:
add in interface BlockingDeque<E>
Specified by:
add in interface BlockingQueue<E>
Specified by:
add in interface Deque<E>
Specified by:
add in interface Queue<E>
Specified by:
add in interface TransactionalCollection<E>

addFirst

public void addFirst(E e)
Specified by:
addFirst in interface BlockingDeque<E>
Specified by:
addFirst in interface 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 BlockingDeque<E>
Specified by:
addLast in interface Deque<E>
Specified by:
addLast in interface TransactionalDeque<E>

offerFirst

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

offerLast

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

offerFirst

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

offerLast

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

doAddLast

protected abstract void doAddLast(E e)

putFirst

public void putFirst(E e)
              throws InterruptedException
Specified by:
putFirst in interface BlockingDeque<E>
Specified by:
putFirst in interface TransactionalDeque<E>
Throws:
InterruptedException

putLast

public void putLast(E e)
             throws InterruptedException
Specified by:
putLast in interface BlockingDeque<E>
Specified by:
putLast in interface TransactionalDeque<E>
Throws:
InterruptedException

takeFirst

public E takeFirst()
            throws InterruptedException
Specified by:
takeFirst in interface BlockingDeque<E>
Specified by:
takeFirst in interface TransactionalDeque<E>
Throws:
InterruptedException

doRemoveFirst

protected abstract E doRemoveFirst()

takeLast

public E takeLast()
           throws InterruptedException
Specified by:
takeLast in interface BlockingDeque<E>
Specified by:
takeLast in interface TransactionalDeque<E>
Throws:
InterruptedException

doRemoveLast

protected abstract E doRemoveLast()

removeFirst

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

removeLast

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

removeFirstOccurrence

public boolean removeFirstOccurrence(Object o)
Specified by:
removeFirstOccurrence in interface BlockingDeque<E>
Specified by:
removeFirstOccurrence in interface Deque<E>
Specified by:
removeFirstOccurrence in interface TransactionalDeque<E>

removeLastOccurrence

public boolean removeLastOccurrence(Object o)
Specified by:
removeLastOccurrence in interface BlockingDeque<E>
Specified by:
removeLastOccurrence in interface Deque<E>
Specified by:
removeLastOccurrence in interface TransactionalDeque<E>

offer

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

put

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

remove

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

poll

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

pollFirst

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

isEmpty

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

pollLast

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

pollFirst

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

pollLast

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

offer

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

poll

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

take

public E take()
       throws InterruptedException
Specified by:
take in interface BlockingDeque<E>
Specified by:
take in interface BlockingQueue<E>
Specified by:
take in interface TransactionalQueue<E>
Throws:
InterruptedException

takeUninterruptible

public E takeUninterruptible()

element

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

peek

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

push

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

drainTo

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

drainTo

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

pop

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

getFirst

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

getLast

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

iterator

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

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface BlockingDeque<E>
Specified by:
iterator in interface 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 Collection<E>
Specified by:
size in interface BlockingDeque<E>
Specified by:
size in interface Deque<E>
Specified by:
size in interface TransactionalCollection<E>

contains

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

toArray

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

toArray

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

remove

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

containsAll

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

removeAll

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

retainAll

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

toString

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


Copyright © 2008-2010 Multiverse. All Rights Reserved.