E
- Should implement the Importance interfacepublic class FixedSizeQueue<E> extends AbstractQueue<E> implements InternalQueue<E>
Constructor and Description |
---|
FixedSizeQueue(int priority,
int capacity)
Create a queue with the given priority and capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Object o) |
int |
drainTo(Collection<? super E> c)
Drain items from this queue to the specified collection
|
int |
drainTo(Collection<? super E> c,
int maxElements)
Drain items from this queue to the specified collection
|
int |
getCapacity()
Return the capacity of the queue
|
Condition |
getNotFullCond()
Get not full condition
|
int |
getPriority()
Get the Priority of the queue
|
Iterator<E> |
iterator() |
boolean |
offer(E e) |
E |
peek() |
E |
poll() |
int |
remainingCapacity()
Remaining capacity of the queue.
|
boolean |
remove(Object o) |
void |
setNotFullCond(Condition notFullCond)
Get not full condition
|
void |
setPriority(int p)
Set the priority
|
int |
size() |
String |
toString() |
containsAll, isEmpty, removeAll, retainAll, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
public FixedSizeQueue(int priority, int capacity)
priority
- priority of the elements in the queuecapacity
- capacity of the queuepublic int getPriority()
InternalQueue
getPriority
in interface InternalQueue<E>
public void setPriority(int p)
InternalQueue
setPriority
in interface InternalQueue<E>
p
- prioritypublic Condition getNotFullCond()
InternalQueue
getNotFullCond
in interface InternalQueue<E>
public void setNotFullCond(Condition notFullCond)
InternalQueue
setNotFullCond
in interface InternalQueue<E>
notFullCond
- conditionpublic Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public int size()
size
in interface Collection<E>
size
in class AbstractCollection<E>
public String toString()
toString
in class AbstractCollection<E>
public int remainingCapacity()
InternalQueue
remainingCapacity
in interface InternalQueue<E>
public int drainTo(Collection<? super E> c)
InternalQueue
drainTo
in interface InternalQueue<E>
c
- collection to add itempublic int drainTo(Collection<? super E> c, int maxElements)
InternalQueue
drainTo
in interface InternalQueue<E>
c
- collection to add itemmaxElements
- maximum number of element to drainpublic int getCapacity()
InternalQueue
getCapacity
in interface InternalQueue<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in class AbstractCollection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in class AbstractCollection<E>
Copyright © 2005-2017 Apache Software Foundation. All Rights Reserved.