Package components.queue
Class QueueSecondary<T>
java.lang.Object
components.queue.QueueSecondary<T>
- Type Parameters:
T
- type ofQueue
entries
- 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Concatenates ("appends")q
to the end ofthis
.final boolean
void
flip()
Reverses ("flips")this
.front()
Reports the front ofthis
.int
hashCode()
replaceFront
(T x) Replaces the front ofthis
withx
, and returns the old front.void
rotate
(int distance) Rotatesthis
.void
sort
(Comparator<T> order) Sortsthis
according to the ordering provided by thecompare
method fromorder
.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface components.queue.QueueKernel
dequeue, enqueue, length
Methods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
-
Constructor Details
-
QueueSecondary
public QueueSecondary()
-
-
Method Details
-
equals
-
hashCode
-
toString
-
front
Description copied from interface:Queue
Reports the front ofthis
. -
replaceFront
Description copied from interface:Queue
Replaces the front ofthis
withx
, and returns the old front.- Specified by:
replaceFront
in interfaceQueue<T>
- Parameters:
x
- the new front entry- Returns:
- the old front entry
-
append
Description copied from interface:Queue
Concatenates ("appends")q
to the end ofthis
. -
flip
Description copied from interface:Queue
Reverses ("flips")this
. -
sort
Description copied from interface:Queue
Sortsthis
according to the ordering provided by thecompare
method fromorder
. -
rotate
Description copied from interface:Queue
Rotatesthis
.
-