Answered step by step
Verified Expert Solution
Question
1 Approved Answer
User package lib 2 8 0 . list; import lib 2 8 0 . base.BilinearIterator 2 8 0 ; import lib 2 8 0 .
User
package liblist;
import libbase.BilinearIterator;
import libexception.BeforeTheStartException;
import libexception.ContainerEmptyException;
A LinkedIterator which has functions to move forward and back,
and to the first and last items of the list. It keeps track of
the current item, and also has functions to determine if it is
before the start or after the end of the list.
public class BilinkedIterator extends LinkedIterator implements BilinearIterator
Constructor creates a new iterator for list 'list'.
Analysis : Time O
@param list list to be iterated
public BilinkedIteratorBilinkedList list
superlist;
Create a new iterator at a specific position in the newList.
Analysis : Time O
@param newList list to be iterated
@param initialPrev the previous node for the initial position
@param initialCur the current node for the initial position
public BilinkedIteratorBilinkedList newList,
LinkedNode initialPrev, LinkedNode initialCur
supernewList initialPrev, initialCur;
Move the cursor to the last element in the list.
@precond The list is not empty.
public void goLast throws ContainerEmptyException
TODO
Move the cursor one element closer to the beginning of the list
@precond before the cursor cannot already be before the first element.
public void goBack throws BeforeTheStartException
TODO
A shallow clone of this object.
Analysis: Time O
public BilinkedIterator clone
return BilinkedIterator super.clone;
The BilinkedList and BilinkedIterator classes in libasn are incomplete. There
are missing method bodies in each class. Each missing method body is tagged with a TODO comment. Write code to implement each of these unfinished method.
Implementation Notes
The javadoc headers for each method explain what each method is supposed to do
Many of the
methods you must implement override methods of the LinkedList superclass.
Add your code right into the existing files within the libasn module.
When implementing the methods, consider carefully any special cases that might cause need to update
the cursor position, or ensure that it remains in a valid state.
You are not permitted to modify any existing code in the java files given. You may only fill in the
missing method bodies.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started