Package components.sequence
Interface Sequence<T>
- Type Parameters:
T- type ofSequenceentries
- All Superinterfaces:
Iterable<T>,SequenceKernel<T>,Standard<Sequence<T>>
- All Known Implementing Classes:
Sequence1L,Sequence2L,Sequence3,SequenceSecondary
SequenceKernel enhanced with secondary methods.-
Method Summary
Modifier and TypeMethodDescriptionvoidConcatenates ("appends")sto the end ofthis.entry(int pos) Reports the entry at positionposofthis.voidRemoves the substring ofthisstarting at positionpos1and ending at positionpos2-1and puts in its.voidflip()Reverses ("flips")this.voidInsertssintothisat positionpos, i.e., after thepos-th entry ofthis; and clearss.replaceEntry(int pos, T x) Replaces the entry at positionposofthiswith the entryxand returns the old entry at that position.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface components.sequence.SequenceKernel
add, length, removeMethods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
-
Method Details
-
entry
Reports the entry at positionposofthis.- Parameters:
pos- the position of the entry- Returns:
- the entry at that position
- Aliases:
- reference returned by
entry - Requires:
0 <= pos and pos < |this|- Ensures:
<entry> = this[pos, pos+1)
-
replaceEntry
Replaces the entry at positionposofthiswith the entryxand returns the old entry at that position.- Parameters:
pos- the position at which to replace an entryx- the entry replacing the old one- Returns:
- the old entry at that position
- Aliases:
- reference
x - Updates:
this- Requires:
0 <= pos and pos < |this|- Ensures:
<replaceEntry> = #this[pos, pos+1) and this = #this[0, pos) * <x> * #this[pos+1, |#this|)
-
append
Concatenates ("appends")sto the end ofthis.- Parameters:
s- theSequenceto be appended- Updates:
this- Clears:
s- Ensures:
this = #this * #s
-
flip
void flip()Reverses ("flips")this.- Updates:
this- Ensures:
this = rev(#this)
-
insert
Insertssintothisat positionpos, i.e., after thepos-th entry ofthis; and clearss.- Parameters:
pos- the position at which to inserts- theSequenceto be inserted- Updates:
this- Clears:
s- Requires:
0 <= pos and pos <= |this|- Ensures:
this = #this[0, pos) * #s * #this[pos, |#this|)
-
extract
Removes the substring ofthisstarting at positionpos1and ending at positionpos2-1and puts in its.- Parameters:
pos1- the position of the first entry that is extractedpos2- the position of the first entry, after the extracted substring, that is not extracteds- upon return, the extracted substring- Updates:
this- Replaces:
s- Requires:
0 <= pos1 and pos1 <= pos2 and pos2 <= |this|- Ensures:
this = #this[0, pos1) * #this[pos2, |#this|) and s = #this[pos1, pos2)
-