Package components.queue
Class QueueSecondary<T>
java.lang.Object
components.queue.QueueSecondary<T>
- Type Parameters:
T- type ofQueueentries
- All Implemented Interfaces:
Queue<T>,QueueKernel<T>,Standard<Queue<T>>,Iterable<T>
Layered implementations of secondary methods for
Queue.
Assuming execution-time performance of O(1) for method iterator and
its return value's method next, execution-time performance of
front as implemented in this class is O(1). Execution-time
performance of replaceFront and flip as implemented in this
class is O(|this|). Execution-time performance of append as
implemented in this class is O(|q|). Execution-time performance of
sort as implemented in this class is O(|this| log
|this|) expected, O(|this|^2) worst case. Execution-time
performance of rotate as implemented in this class is
O(distance mod |this|).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConcatenates ("appends")qto the end ofthis.final booleanvoidflip()Reverses ("flips")this.front()Reports the front ofthis.inthashCode()replaceFront(T x) Replaces the front ofthiswithx, and returns the old front.voidrotate(int distance) Rotatesthis.voidsort(Comparator<T> order) Sortsthisaccording to the ordering provided by thecomparemethod fromorder.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface components.queue.QueueKernel
dequeue, enqueue, lengthMethods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
-
Constructor Details
-
QueueSecondary
public QueueSecondary()
-
-
Method Details
-
equals
-
hashCode
-
toString
-
front
Description copied from interface:QueueReports the front ofthis. -
replaceFront
Description copied from interface:QueueReplaces the front ofthiswithx, and returns the old front.- Specified by:
replaceFrontin interfaceQueue<T>- Parameters:
x- the new front entry- Returns:
- the old front entry
-
append
Description copied from interface:QueueConcatenates ("appends")qto the end ofthis. -
flip
Description copied from interface:QueueReverses ("flips")this. -
sort
Description copied from interface:QueueSortsthisaccording to the ordering provided by thecomparemethod fromorder. -
rotate
Description copied from interface:QueueRotatesthis.
-