Package components.list
Interface List<T>
- Type Parameters:
T
- type ofList
entries
- All Superinterfaces:
Iterable<T>
,ListKernel<T>
,Standard<List<T>>
- All Known Implementing Classes:
List1L
,List2
,List3
,ListSecondary
ListKernel
enhanced with secondary methods.-
Method Summary
Modifier and TypeMethodDescriptionvoid
Moves the position inthis
to the end.Replaces the entry at the front ofthis.right
withx
, and returns the old entry.void
retreat()
Retreats the position inthis
by one.Reports the front ofthis.right
.void
swapRights
(List<T> list) Swaps the right strings ofthis
andlist
.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface components.list.ListKernel
addRightFront, advance, leftLength, moveToStart, removeRightFront, rightLength
Methods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
-
Method Details
-
rightFront
T rightFront()Reports the front ofthis.right
.- Returns:
- the front entry of
this.right
- Aliases:
- reference returned by
rightFront
- Requires:
this.right /= <>
- Ensures:
<rightFront> is prefix of this.right
-
replaceRightFront
Replaces the entry at the front ofthis.right
withx
, and returns the old entry.- Parameters:
x
- the new entry- Returns:
- the old front entry of
this.right
- Aliases:
- reference
x
- Updates:
this.right
- Requires:
this.right /= <>
- Ensures:
<replaceRightFront> is prefix of #this.right and this.right = <x> * #this.right[1, |#this.right|)
-
moveToFinish
void moveToFinish()Moves the position inthis
to the end.- Updates:
this
- Ensures:
this.left = #this.left * #this.right and |this.right| = 0
-
retreat
void retreat()Retreats the position inthis
by one.- Updates:
this
- Requires:
this.left /= <>
- Ensures:
this.left * this.right = #this.left * #this.right and |this.left| = |#this.left| - 1
-
swapRights
Swaps the right strings ofthis
andlist
.- Parameters:
list
- theList
whose right string is to be swapped with the right string ofthis
- Updates:
this.right, list.right
- Ensures:
this.left = #this.left and list.left = #list.left and this.right = #list.right and list.right = #this.right
-