public class CharArrayFIFOQueue extends java.lang.Object implements CharPriorityDequeue, ITrimmable
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_CAPACITY
The Minimum Capacity that is allowed
|
| Constructor and Description |
|---|
CharArrayFIFOQueue()
Default Construtor
|
CharArrayFIFOQueue(char[] values)
Constructor using a initial array
|
CharArrayFIFOQueue(char[] values,
int size)
Constructor using a initial array
|
CharArrayFIFOQueue(char[] values,
int offset,
int size)
Constructor using a initial array
|
CharArrayFIFOQueue(int capacity)
Constructor with a Min Capacity
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
clears all elements within the PriorityQueue,
this does not resize the backing arrays
|
void |
clearAndTrim(int size)
Trims the collection down to the requested size and clears all elements while doing so
|
CharComparator |
comparator() |
char |
dequeueChar()
Method to extract a element from the PriorityQueue
|
char |
dequeueLastChar()
A Method to remove a element from the last place instead of the first
|
void |
enqueueChar(char e)
Method to insert a element into the PriorityQueue
|
void |
enqueueFirstChar(char e)
Method to insert a element into the first Index instead of the last.
|
CharIterator |
iterator()
Returns an iterator over elements of type
T. |
void |
onChanged()
Allows to notify the Queue to be revalidate its data
|
char |
peekChar(int index)
Peeking function to see whats inside the queue.
|
boolean |
removeChar(char e)
Removes the first found element in the queue
|
boolean |
removeLastChar(char e)
Removes the last found element in the queue
|
int |
size() |
java.lang.Character[] |
toArray(java.lang.Character[] input)
A method to drop the contents of the Queue without clearing the queue
|
char[] |
toCharArray(char[] input)
A method to drop the contents of the Queue without clearing the queue
|
boolean |
trim(int size)
Trims the original collection down to the size of the current elements or the requested size depending which is bigger
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdequeueLast, enqueueFirst, last, lastChardequeue, enqueue, first, firstChar, peek, remove, removeLast, toArray, toCharArrayisEmptyforEach, forEach, spliteratorclearAndTrim, trimpublic static final int MIN_CAPACITY
public CharArrayFIFOQueue(char[] values)
values - the Array that should be usedpublic CharArrayFIFOQueue(char[] values,
int size)
values - the Array that should be usedsize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic CharArrayFIFOQueue(char[] values,
int offset,
int size)
values - the Array that should be usedoffset - where to begin in the initial arraysize - the amount of elements that are in the initial arrayjava.lang.IllegalStateException - if values is smaller then sizepublic CharArrayFIFOQueue(int capacity)
capacity - the initial capacity of the backing arrayjava.lang.IllegalStateException - if the initial size is smaller 0public CharArrayFIFOQueue()
public CharIterator iterator()
CharIterableT.iterator in interface java.lang.Iterable<java.lang.Character>iterator in interface CharIterablepublic int size()
size in interface ObjectPriorityQueue<java.lang.Character>public void clear()
ObjectPriorityQueueclear in interface ObjectPriorityQueue<java.lang.Character>public void enqueueChar(char e)
CharPriorityQueueenqueueChar in interface CharPriorityQueuee - the element that should be insertedpublic void enqueueFirstChar(char e)
CharPriorityDequeueenqueueFirstChar in interface CharPriorityDequeuee - the element that should be inserted into the first placepublic char dequeueChar()
CharPriorityQueuedequeueChar in interface CharPriorityQueuepublic char dequeueLastChar()
CharPriorityDequeuedequeueLastChar in interface CharPriorityDequeuepublic char peekChar(int index)
CharPriorityQueuepeekChar in interface CharPriorityQueueindex - of the element that is requested to be viewed.public boolean removeChar(char e)
CharPriorityQueueremoveChar in interface CharPriorityQueuee - the element that should be removedpublic boolean removeLastChar(char e)
CharPriorityQueueremoveLastChar in interface CharPriorityQueuee - the element that should be removedpublic void onChanged()
CharPriorityQueueonChanged in interface CharPriorityQueueonChanged in interface ObjectPriorityQueue<java.lang.Character>public CharComparator comparator()
comparator in interface CharPriorityQueuecomparator in interface ObjectPriorityQueue<java.lang.Character>public boolean trim(int size)
ITrimmabletrim in interface ITrimmablesize - the requested trim size.public void clearAndTrim(int size)
clearAndTrim in interface ITrimmablesize - the amount of elements that should be allowedpublic char[] toCharArray(char[] input)
CharPriorityQueuetoCharArray in interface CharPriorityQueueinput - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created arraypublic java.lang.Character[] toArray(java.lang.Character[] input)
ObjectPriorityQueuetoArray in interface CharPriorityQueuetoArray in interface ObjectPriorityQueue<java.lang.Character>input - where the elements should be inserted to. If it does not fit then it creates a new appropiatly created array