Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA 2. SlideListNode Class Write a full-documented class named SlideListNode that wraps a Slide object to allow it to be inserted into a doubly

IN JAVA

2. SlideListNode Class

Write a full-documented class named SlideListNode that wraps a Slide object to allow it to be inserted into a doubly linked-list data structure. The Slide object reference should be contained in a field called data, and there should be two SlideListNode references serving as links to the previous and next SlideListNodes in the list. The class will be based on the following ADT specification:

private Slide data

private SlideListNode next

private SlideListNode prev

public SlideListNode(Slide initData)

Brief:

Default constructor.

Parameters: initData

The data to be wrapped by this SlideListNode. This parameter should not be null, since we should never have a SlideListNode with null data (remember, this class serves only as a wrapper for the Slide class).

Preconditions:

initData is not null.

Postconditions:

This SlideListNode has been initialized to wrap the indicated Slide, and prev and next have been set to null.

Throws: IllegalArgumentException

Thrown if initData is null.

public Slide getData()

Brief:

Gets the reference to the data member variable of the list node.

Returns:

The reference of the data member variable.

public void setData(Slide newData)

Brief:

Updates the data member variable with a reference to a new Slide.

Parameters: newData

Reference to a new Slide object to update the data member variable. This parameter should not be null, since we should never have a SlideListNode with null data (remember, this class serves only as a wrapper for the Slide class).

Preconditions:

newData is not null.

Throws: IllegalArgumentException

Thrown if newData is null.

public SlideListNode getNext()

Brief:

Gets the reference to the next member variable of the list node.

Returns:

The reference of the next member variable. Note that this return value can be null, meaning that there is no next SlideListNode in the list.

public void setNext(SlideListNode newNext)

Brief:

Updates the next member variable with a new SlideListNode reference.

Parameters: newNext

Reference to a new SlideListNode object to update the next member variable. This parameter may be null, since it is okay to have no next SlideListNode (this means weve reached the tail of the list!).

public SlideListNode getPrev()

Brief:

Gets the reference to the prev member variable of the list node.

Returns:

The reference of the prev member variable. Note that this return value can be null, meaning that there is no previous SlideListNode in the list. (this means weve reached the head of the list!).

public void setPrev(SlideListNode newPrev)

Brief:

Updates the prev member variable with a new SlideListNode reference.

Parameters: newPrev

Reference to a new SlideListNode object to update the prev member variable. This parameter may be null, since it is okay to have no previous SlideListNode (this means weve reached the head of the list!).

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

Students also viewed these Databases questions

Question

=+ What skills and competencies will enable someone

Answered: 1 week ago

Question

=+to live and work wherever he or she wants?

Answered: 1 week ago

Question

=+How will this affect the recruiting process?

Answered: 1 week ago