Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

package lib 2 8 0 . list; import lib 2 8 0 . base.BilinearIterator 2 8 0 ; import lib 2 8 0 . exception.BeforeTheStart

package lib
2
8
0
.
list;
import lib
2
8
0
.
base.BilinearIterator
2
8
0
;
import lib
2
8
0
.
exception.BeforeTheStart
2
8
0
Exception;
import lib
2
8
0
.
exception.ContainerEmpty
2
8
0
Exception;
/
*
*
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
2
8
0
extends LinkedIterator
2
8
0
implements BilinearIterator
2
8
0
{
/
*
*
Constructor creates a new iterator for list 'list'.
Analysis : Time
=
O
(
1
)
@param list list to be iterated
*
/
public BilinkedIterator
2
8
0
(
BilinkedList
2
8
0
list
)
{
super
(
list
)
;
}
/
*
*
Create a new iterator at a specific position in the newList.
Analysis : Time
=
O
(
1
)
@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 BilinkedIterator
2
8
0
(
BilinkedList
2
8
0
newList,
LinkedNode
2
8
0
initialPrev, LinkedNode
2
8
0
initialCur
)
{
super
(
newList
,
initialPrev, initialCur
)
;
}
/
*
*
*
Move the cursor to the last element in the list.
*
@precond The list is not empty.
*
/
public void goLast
(
)
throws ContainerEmpty
2
8
0
Exception
{
/
/
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 BeforeTheStart
2
8
0
Exception
{
/
/
TODO
}
/
*
*
A shallow clone of this object.
Analysis: Time
=
O
(
1
)
*
/
public BilinkedIterator
2
8
0
clone
(
)
{
return
(
BilinkedIterator
2
8
0
)
super.clone
(
)
;
}
}
The BilinkedList
2
8
0
and BilinkedIterator
2
8
0
classes in lib
2
8
0
-
asn
1
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
3
.
Many of the
methods you must implement override methods of the LinkedList
2
8
0
superclass.
Add your code right into the existing files within the lib
2
8
0
-
asn
1
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.
please solve the question using the starter file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

1. Which position would you take?

Answered: 1 week ago