giden.GRDS
Class LinkList

java.lang.Object
  |
  +--giden.GRDS.LinkList
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
SingleLinkList

public class LinkList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Copyright (c) 1993-2004 C. R. Coullard, D. S. Dilworth, J. H. Owen, All Rights Reserved.
We make no representations or warranties about the suitability of the software, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. We shall not be liable for any damages suffered by user as a result of using, modifying or distributing this software or its derivatives.

LinkList is a base class that is inherited by the SingleLinkList and DoubleLinkList classes. Although the current LinkList class implements a double link list, the future design is to implement the single link and double link functionality in the above named classes. To ensure future compatibility, users should create SingleLinkList or DoubleLinkList objects; these objects can then be manipulated as LinkList objects.

A LinkList is comprised of ListEntry objects. Each ListEntry object contains link information for the list and the list-item of interest to the application. The LinkList class only provides methods for iterating with ListEntry objects; the user can access the underlying list-items by manipulating the ListEntry objects. The ListIter class is an easier and recommended way of iterating and accessing the list-items. Any method returning a ListEntry will return null if accesses are attempted on an empty list or beyond the boundaries of the list.

Copyright (c) 1993-2003 C. R. Coullard, D. S. Dilworth, J. H. Owen, All Rights Reserved.

Version:
4.0a 2004 08 27
Author:
D. S. Dilworth
See Also:
Network, DoubleLinkList, ListEntry, ListIter, SingleLinkList, Serialized Form

Constructor Summary
LinkList()
          Creates an empty link list.
 
Method Summary
 ListEntry AddItem(java.lang.Object item)
          Adds an item to this list
 java.lang.Object clone()
          Returns a clone of this list
 void DeleteContents()
          Deletes all entries in this list
 void DeleteEntry(ListEntry entry)
          Deletes the list entry
 ListEntry GetFirstEntry()
          Gets the first entry in this list
 ListEntry GetHead()
          Gets the head of this list
 ListEntry GetLastEntry()
          Gets the last entry in this list
 ListEntry GetNextEntry(ListEntry entry)
          Gets the next entry in this list
 ListEntry GetPrevEntry(ListEntry entry)
          Gets the previous entry in this list
 int GetSize()
          Gets the current number of items in this list
 ListEntry GetTail()
          Gets the tail of this list
 boolean InsertBefore(ListEntry first, ListEntry second)
          Inserts the second entry after the first entry.
 void JoinList(LinkList list)
          Appends the given list to this list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkList

public LinkList()
Creates an empty link list. This is a list with no ListEntry objects. For an empty list, the head and tail items are null.
Method Detail

clone

public java.lang.Object clone()
Returns a clone of this list

GetSize

public int GetSize()
Gets the current number of items in this list
Returns:
The number of entries in this list

AddItem

public ListEntry AddItem(java.lang.Object item)
Adds an item to this list
Parameters:
item - the item to be added to this list
Returns:
The ListEntry containing the item.

JoinList

public void JoinList(LinkList list)
Appends the given list to this list
Parameters:
list - The list to append to this list object.

GetHead

public ListEntry GetHead()
Gets the head of this list
Returns:
The ListEntry at the head of this list.

GetTail

public ListEntry GetTail()
Gets the tail of this list
Returns:
The ListEntry at the tail of this list

GetFirstEntry

public ListEntry GetFirstEntry()
Gets the first entry in this list
Returns:
The first ListEntry in this list

GetNextEntry

public ListEntry GetNextEntry(ListEntry entry)
Gets the next entry in this list
Parameters:
entry - the current position in this list
Returns:
The next ListEntry in this list.

GetPrevEntry

public ListEntry GetPrevEntry(ListEntry entry)
Gets the previous entry in this list
Parameters:
entry - the current position in this list
Returns:
The previous ListEntry in this list

GetLastEntry

public ListEntry GetLastEntry()
Gets the last entry in this list
Returns:
The last ListEntry in this list

DeleteEntry

public void DeleteEntry(ListEntry entry)
Deletes the list entry
Parameters:
entry - the entry to delete from this list

InsertBefore

public boolean InsertBefore(ListEntry first,
                            ListEntry second)
Inserts the second entry after the first entry. Assumes first is in list and second is not Should not delete or create ListEntries

DeleteContents

public void DeleteContents()
Deletes all entries in this list