Module Design - Link Object

Version: 1.0

Last Modified: 04/27/98


This object was designed by Johan Raffin
Private Data:
int linkType: Will store the type of a link (prev or next).
Line[] linkComponent: Collection of line pointer to form a link (series of lines) - Dynamic array of line object.
int numLines: Stores the numbers of lines in a link (so we know where the last line is).

public void AddLine(Line);
Overview: stores a line pointer to the LinkComponent array and increment the number of lines in the link.
Parameters: pointer to a Line object.
Pre-conditions: None.
Post-conditions: NumLines is incremented and a line object is referenced in the LinkComponentArray.
Algorithm: Increment the number of lines everytime a line segment is added. Add a line pointer to the LinkComponent array that will refer to a line object. The LinkComponent array is sorted: 1st line is line going from node, last line is line arriving at destination node.
Interaction with other Objects: None.
Error conditions: None.
Return Value: None.
public Line GetLastLine(void);
Overview: Finds the last line segment in the linkComponent array.
Parameters: None.
Pre-conditions: Need a valid array index in LinkComponent array. LinkComponent array should not be empty.
Post-conditions: None.
Algorithm: Search the LinkComponent array for the last inserted line (should be the last line pointer in the array).
Interaction with other Objects: None.
Error condition: If array is empty or the array index is incorrect..
Return Value: a reference (of type Line) to a line object from the LinkComponent array.
public void DeleteLink(void);
Overview: Delete a link.
Parameters: None.
Pre-conditions: The LinkComponent array must contain an entry and the array index must be valid.
Post-conditions: A link will be deleted and the LinkComponent array containing data for that link will be initialized.
Algorithm: Invoke the DeleteLine() function on each line forming the link. The DeleteLine() is called from the Line object. Note that Java will destroy the pointers from the Link object to the Line object because of Java's garbage collector. Initialize all entries (line pointers) pertaining to that link in the LinkComponent array.
Interaction with other Objects: Line object.
Error conditions: Check for proper interaction with the Line object. If array is empty or array index is invalid call error message.
Return Value: None.

Search engine sitemap created by