T
- public interface LinkedListKernel<T> extends Standard<LinkedList<T>>
LinkedList
kernel component containing method headers and contracts
for all methods that will directly interact with the label representations of
all LinkedList implementations. All sub-interface methods should use only
these methods to perform operations on the LinkedList
.Modifier and Type | Method and Description |
---|---|
void |
add(T entry)
Appends
entry to the end of #this. |
void |
addToFront(T entry)
Adds
entry to the front of #this. |
void |
advance()
Shifts
#this.focus forward by 1 position. |
T |
focus()
Returns a reference to
#this.focus . |
void |
insert(T entry)
Inserts
entry into #this at the position directly
following the #this.focus . |
int |
length()
Returns the number of entries in
this . |
void |
moveToFront()
Shifts
this.focus to the front of the list. |
void |
moveToRear()
Moves
#this.focus to the last entry in this . |
int |
position()
Returns the position of
#this.focus . |
T |
remove()
Removes
this.focus and returns it to the caller. |
void |
retreat()
Shifts
this.focus to the entry previous to #this.focus . |
clear, newInstance, transferFrom
void add(T entry)
entry
to the end of #this.entry
- item to be appended to this
void addToFront(T entry)
entry
to the front of #this.entry
- item to be prepended to this
T remove()
this.focus
and returns it to the caller.
this.focus
will be shifted to the right, and if
#this.focus
was the last entry, then this.focus
shifts to
the first entry in #this
.#this.focus
remove = [#this.focus] and [if #this.focus is the final entry in the list, this.focus will be the first entry in the array]
void advance()
#this.focus
forward by 1 position.void retreat()
this.focus
to the entry previous to #this.focus
.void moveToFront()
this.focus
to the front of the list.int length()
this
.this
void insert(T entry)
entry
into #this
at the position directly
following the #this.focus
.entry
- entry to be inserted into the listthis = [(entries before #this.focus) * #this.focus * entry * (entries after #this.focus)] and [this.focus = #this.focus]
T focus()
#this.focus
.#this.focus
void moveToRear()
#this.focus
to the last entry in this
.int position()
#this.focus
.this.focus
fron the front of the listif this.length == 0, then position = -1 else position = [the distance of the focus from the first entry in the list]