|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractQueue<E> org.amino.ds.lockfree.EBDeque<E>
E
- type of element in the dequepublic class EBDeque<E>
This Deque implementation is based on the algorithm defined in the follwoing paper: CAS-Based Lock-Free Algorithm for Shared Deques By Maged M. Michael
This deque add elimination mechanism to deal with high contention rate
scenario. Please read about EliminationArray
to get
more information. If we don't consider elimination backoff, this class
implements the same algorithm as LockFreeDeque
Constructor Summary | |
---|---|
EBDeque()
default constructor. |
|
EBDeque(int eliminationSize)
|
Method Summary | |
---|---|
boolean |
add(E e)
Inserts element e at the end of the deque. |
void |
addFirst(E d)
This is the method that does a right push into the Deque. |
void |
addLast(E d)
This is the method that does a left push into the Deque. |
void |
clear()
Removes all elements, clears the deque. |
boolean |
contains(java.lang.Object o)
|
java.util.Iterator<E> |
descendingIterator()
|
void |
dump()
It's used for debugging purpose. |
E |
element()
Returns head (first element) of this deque, but does not remove it. |
E |
getFirst()
|
E |
getLast()
|
boolean |
isEmpty()
Checks to see if the deque is empty or not. |
java.util.Iterator<E> |
iterator()
|
boolean |
offer(E e)
Inserts element e at the tail of this deque. |
boolean |
offerFirst(E e)
|
boolean |
offerLast(E e)
|
E |
peek()
Returns the first element of this deque, or null if deque is empty. |
E |
peekFirst()
|
E |
peekLast()
|
E |
poll()
Returns and removes first (head) element of this deque, or null if this deque is empty. |
E |
pollFirst()
This is the method to pop the Right node from the Deque. |
E |
pollLast()
|
E |
pop()
|
void |
push(E e)
|
E |
remove()
Returns and removes the first element in this deque. |
boolean |
remove(java.lang.Object o)
Remove first occurrence of specified object o in this deque. |
E |
removeFirst()
|
boolean |
removeFirstOccurrence(java.lang.Object o)
|
E |
removeLast()
|
boolean |
removeLastOccurrence(java.lang.Object o)
|
int |
size()
|
Methods inherited from class java.util.AbstractQueue |
---|
addAll |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public EBDeque()
public EBDeque(int eliminationSize)
eliminationSize
- default size of elimination arrayMethod Detail |
---|
public void dump()
public E element()
element
in interface java.util.Deque<E>
element
in interface java.util.Queue<E>
element
in class java.util.AbstractQueue<E>
java.util.NoSuchElementException
public boolean offer(E e)
addLast(E)
.
offer
in interface java.util.Deque<E>
offer
in interface java.util.Queue<E>
e
- element to insert
public E peek()
peek
in interface java.util.Deque<E>
peek
in interface java.util.Queue<E>
public E poll()
poll
in interface java.util.Deque<E>
poll
in interface java.util.Queue<E>
public E remove()
remove
in interface java.util.Deque<E>
remove
in interface java.util.Queue<E>
remove
in class java.util.AbstractQueue<E>
public java.util.Iterator<E> descendingIterator()
descendingIterator
in interface java.util.Deque<E>
public E getFirst()
getFirst
in interface java.util.Deque<E>
public E getLast()
getLast
in interface java.util.Deque<E>
public boolean offerFirst(E e)
offerFirst
in interface java.util.Deque<E>
public boolean offerLast(E e)
offerLast
in interface java.util.Deque<E>
public E removeFirst()
removeFirst
in interface java.util.Deque<E>
public boolean removeFirstOccurrence(java.lang.Object o)
removeFirstOccurrence
in interface java.util.Deque<E>
public E removeLast()
removeLast
in interface java.util.Deque<E>
public boolean removeLastOccurrence(java.lang.Object o)
removeLastOccurrence
in interface java.util.Deque<E>
public boolean add(E e)
add
in interface java.util.Collection<E>
add
in interface java.util.Deque<E>
add
in interface java.util.Queue<E>
add
in class java.util.AbstractQueue<E>
e
- element being added to the end of the deque.
public void clear()
clear
in interface java.util.Collection<E>
clear
in class java.util.AbstractQueue<E>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<E>
contains
in interface java.util.Deque<E>
contains
in class java.util.AbstractCollection<E>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<E>
isEmpty
in class java.util.AbstractCollection<E>
public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
iterator
in interface java.util.Collection<E>
iterator
in interface java.util.Deque<E>
iterator
in class java.util.AbstractCollection<E>
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<E>
remove
in interface java.util.Deque<E>
remove
in class java.util.AbstractCollection<E>
o
- element to be removed, if present.
public int size()
size
in interface java.util.Collection<E>
size
in interface java.util.Deque<E>
size
in class java.util.AbstractCollection<E>
public void addFirst(E d)
addFirst
in interface java.util.Deque<E>
d
- element to addpublic E peekFirst()
peekFirst
in interface java.util.Deque<E>
public E pollFirst()
pollFirst
in interface java.util.Deque<E>
public void addLast(E d)
addLast
in interface java.util.Deque<E>
d
- elementpublic E peekLast()
peekLast
in interface java.util.Deque<E>
public E pollLast()
pollLast
in interface java.util.Deque<E>
public E pop()
pop
in interface java.util.Deque<E>
public void push(E e)
push
in interface java.util.Deque<E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |