cs015.PizzaDex
Interface ListInterface


public interface ListInterface


Method Summary
 void delete(PizzaData keyToDelete)
          The Delete method is called when an item from the linked list is to be deleted.
 boolean empty()
          This function should return true if the list is empty, false otherwise.
 PizzaData getCurrentData()
          This function returns the current data element of the linked list.
 void insert(PizzaData data)
          The Insert method is called on a linked list when an item has to be inserted.
 void next()
          This method is used to set the current node reference to refer to the node after it.
 void prev()
          This method is used to set the current node reference to refer to the node preceding it.
 PizzaData search(PizzaData keyToFind)
          The Search method is used to find a particular entry in the linked list.
 

Method Detail

insert

public void insert(PizzaData data)
The Insert method is called on a linked list when an item has to be inserted. Your linked list should create a node to hold the data and insert the node at the right place in the list.

Parameters:
data - - The data item to insert.

delete

public void delete(PizzaData keyToDelete)
The Delete method is called when an item from the linked list is to be deleted. The "keyToDelete" parameter it receives is a dummy data item that contains the information required to find the correct entry to delete. In PizzaDex, we use the name of the pizzeria to determine which entry to delete. The rest of the information in the dummy data item is not used, and therefore inconsequential.

Parameters:
keyToDelete - - The dummy data item representing the data to delete.

search

public PizzaData search(PizzaData keyToFind)
The Search method is used to find a particular entry in the linked list. The parameter it receives is a dummy data item holding the information necessary to find the desired item. It does not need to hold all the same information as the data item stored in the linked list, all it needs is enough information to find a particular item. In PizzaDex, we need only the name of the pizzeria in order to search for it.

Parameters:
keyToFind - - The dummy data item used to find the desired one.
Returns:
- The data item found, or null if it does not exist.

prev

public void prev()
This method is used to set the current node reference to refer to the node preceding it.

Returns:
- The data item of the previous node

next

public void next()
This method is used to set the current node reference to refer to the node after it.


empty

public boolean empty()
This function should return true if the list is empty, false otherwise.

Returns:
- A boolean indicating whether the list is empty or not.

getCurrentData

public PizzaData getCurrentData()
This function returns the current data element of the linked list.

Returns:
- The current data element.