Package com.google.code.yanf4j.util
Class CircularQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.google.code.yanf4j.util.CircularQueue<E>
- Type Parameters:
E
-
- All Implemented Interfaces:
Serializable
,Iterable<E>
,Collection<E>
,List<E>
,Queue<E>
,SequencedCollection<E>
A circular queue from mina
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private int
private boolean
private final int
private Object[]
private int
private int
private static final long
private int
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
int
capacity()
Returns the capacity of this queue.private void
checkIndex
(int idx) void
clear()
private void
element()
private void
get
(int idx) private int
getRealIndex
(int idx) private void
boolean
isEmpty()
private static int
normalizeCapacity
(int initialCapacity) boolean
peek()
poll()
remove()
remove
(int idx) private void
int
size()
toString()
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, addAll, addFirst, addLast, contains, containsAll, equals, getFirst, getLast, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, subList, toArray, toArray
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
DEFAULT_CAPACITY
private static final int DEFAULT_CAPACITY- See Also:
-
initialCapacity
private final int initialCapacity -
items
-
mask
private int mask -
first
private int first -
last
private int last -
full
private boolean full -
shrinkThreshold
private int shrinkThreshold
-
-
Constructor Details
-
CircularQueue
public CircularQueue()Construct a new, empty queue. -
CircularQueue
public CircularQueue(int initialCapacity)
-
-
Method Details
-
normalizeCapacity
private static int normalizeCapacity(int initialCapacity) -
capacity
public int capacity()Returns the capacity of this queue. -
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceList<E>
- Overrides:
clear
in classAbstractList<E>
-
poll
-
offer
-
peek
-
get
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceList<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classAbstractCollection<E>
-
toString
- Overrides:
toString
in classAbstractCollection<E>
-
checkIndex
private void checkIndex(int idx) -
getRealIndex
private int getRealIndex(int idx) -
increaseSize
private void increaseSize() -
decreaseSize
private void decreaseSize() -
expandIfNeeded
private void expandIfNeeded() -
shrinkIfNeeded
private void shrinkIfNeeded() -
add
-
set
-
add
-
remove
-
remove
-
element
-