Package components.queue
Class Queue3<T>
java.lang.Object
components.queue.QueueSecondary<T>
components.queue.Queue3<T>
- Type Parameters:
T- type ofQueueentries
- All Implemented Interfaces:
Queue<T>,QueueKernel<T>,Standard<Queue<T>>,Iterable<T>
Queue represented as a Sequence of entries, with
implementations of primary methods.- Abstraction Relation (interpretation mapping between $this and this):
this = $this.entries
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclear()Resetsthisto an initial value.final Tdequeue()Removes and returns the entry at the front ofthis.final voidAddsxto the end ofthis.iterator()final intlength()Reports length ofthis.Returns a new object with the same dynamic type asthis, having an initial value.final TreplaceFront(T x) Replaces the front ofthiswithx, and returns the old front.final voidtransferFrom(Queue<T> source) Setsthisto the incoming value ofsource, and resetssourceto an initial value; the declaration notwithstanding, the dynamic type ofsourcemust be the same as the dynamic type ofthis.Methods inherited from class components.queue.QueueSecondary
append, equals, flip, front, hashCode, rotate, sort, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Queue3
public Queue3()No-argument constructor.
-
-
Method Details
-
newInstance
Description copied from interface:StandardReturns a new object with the same dynamic type asthis, having an initial value. If the typeThas a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor forT. IfTdoes not have a no-argument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initializethis.- Returns:
- new object "like"
thiswith an initial value
-
clear
Description copied from interface:StandardResetsthisto an initial value. If the typeThas a no-argument constructor, thenthissatisfies the contract of the no-argument constructor forT. IfTdoes not have a no-argument constructor, thenthissatisfies the contract of the constructor call that was used to initialize#this. -
transferFrom
Description copied from interface:StandardSetsthisto the incoming value ofsource, and resetssourceto an initial value; the declaration notwithstanding, the dynamic type ofsourcemust be the same as the dynamic type ofthis. If the typeThas a no-argument constructor, thensourcesatisfies the contract of the no-argument constructor forT. IfTdoes not have a no-argument constructor, thensourcesatisfies the contract of the constructor call that was used to initialize#source.- Parameters:
source- object whose value is to be transferred
-
enqueue
Description copied from interface:QueueKernelAddsxto the end ofthis.- Parameters:
x- the entry to be added
-
dequeue
Description copied from interface:QueueKernelRemoves and returns the entry at the front ofthis.- Returns:
- the entry removed
-
length
Description copied from interface:QueueKernelReports length ofthis.- Returns:
- the length of
this
-
iterator
-
replaceFront
Description copied from interface:QueueReplaces the front ofthiswithx, and returns the old front.- Specified by:
replaceFrontin interfaceQueue<T>- Overrides:
replaceFrontin classQueueSecondary<T>- Parameters:
x- the new front entry- Returns:
- the old front entry
-