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 interface Iterable
forEach, iterator, spliteratorMethods inherited from interface QueueKernel
dequeue, enqueue, lengthMethods inherited from interface Standard
clear, newInstance, transferFrom
-
Constructor Details
-
QueueSecondary
public QueueSecondary()
-
-
Method Details
-
equals
-
hashCode
-
toString
-
front
-
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
-
flip
-
sort
-
rotate
-