giden.GRDS
Class ListIter

java.lang.Object
  |
  +--giden.GRDS.ListIter
Direct Known Subclasses:
EdgeListIter, NodeListIter

public class ListIter
extends java.lang.Object

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.

ListIter provides methods for accessing LinkList, SingleLinkList, and DoubleLinkList objects, and is the recommended way of manipulating these link list objects. The ListIter methods include forward and backward iteration through the list and retrieval of the list-item. It does not provide methods for altering the list contents; those methods are provided by the link list classes. A newly created ListIter is initialized to null. At some point prior to using a newly created ListIter to access the list, GetFirstItem() or GetLastItem() must be called.

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:
DoubleLinkList, LinkList, ListEntry, Network, SingleLinkList

Field Summary
 ListEntry Entry
          Internal data member
 LinkList List
          Internal data member
 
Constructor Summary
ListIter(LinkList list)
          Creates a ListIter object for the given list and initializes it to null.
 
Method Summary
 java.lang.Object GetFirstItem()
          Moves this ListIter to the ListEntry at the head of the list and gets that ListEntry's item.
 java.lang.Object GetItem()
          Gets the list-item at the current list location
 java.lang.Object GetLastItem()
          Moves this ListIter to the last ListEntry in the list and gets that ListEntry's item.
 java.lang.Object GetNextItem()
          Moves this ListIter to the next ListEntry in the list and gets that ListEntry's item.
 java.lang.Object GetPrevItem()
          Moves this ListIter to the previous ListEntry in the list and gets that ListEntry's item.
 int GetSize()
          Gets a count of items in the list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

List

public LinkList List
Internal data member

Entry

public ListEntry Entry
Internal data member
Constructor Detail

ListIter

public ListIter(LinkList list)
Creates a ListIter object for the given list and initializes it to null. In order to use this ListIter to access items in the list, GetFirstItem() or GetLastItem must initially be called.
Parameters:
list - The LinkList to be accessed.
Method Detail

GetSize

public int GetSize()
Gets a count of items in the list. NODE ADJACENCY LIST WARNING: Although this count is correct for the total number of edges adjacent to a node, it is not correct for the incoming and outgoing adjacency lists. A node only stores one adjacency list, and both the IncListIter and OutListIter classes use that same list to test which of those edges are incoming or outgoing edges.
Returns:
The number of entries in the list

GetItem

public java.lang.Object GetItem()
Gets the list-item at the current list location
Returns:
The list-item stored in the current ListEntry

GetFirstItem

public java.lang.Object GetFirstItem()
Moves this ListIter to the ListEntry at the head of the list and gets that ListEntry's item.

GetNextItem

public java.lang.Object GetNextItem()
Moves this ListIter to the next ListEntry in the list and gets that ListEntry's item.

GetPrevItem

public java.lang.Object GetPrevItem()
Moves this ListIter to the previous ListEntry in the list and gets that ListEntry's item.

GetLastItem

public java.lang.Object GetLastItem()
Moves this ListIter to the last ListEntry in the list and gets that ListEntry's item.