com.nwoods.jgo
Interface JGoObjectSimpleCollection

All Known Subinterfaces:
JGoObjectCollection
All Known Implementing Classes:
JGoArea, JGoCollection, JGoDocument, JGoLayer, JGoSelection, JGoView

public interface JGoObjectSimpleCollection

This interface provides the basic methods for iterating through a collection of JGoObjects.

There are two methods for getting the "next" object. getNextObjectPosAtTop() always treats this collection as a simple list; use this method for a normal list traversal. getNextObjectPos() may be implemented by some collections to do a tree walk, recursing through the collections offered by JGoObjects that are actually JGoAreas. For some simple collections the two methods will be implemented in the same top-level only manner.


Method Summary
 JGoListPosition getFirstObjectPos()
          Return the position of the first object in the collection.
 JGoListPosition getNextObjectPos(JGoListPosition pos)
          Return the position for the next object in the collection.
 JGoListPosition getNextObjectPosAtTop(JGoListPosition pos)
          Return the position for the next top-level object in the collection.
 int getNumObjects()
          Return the number of top-level objects in the collection.
 JGoObject getObjectAtPos(JGoListPosition pos)
          Return the object for the given position.
 boolean isEmpty()
          Return true if there are no objects in the collection.
 

Method Detail

getNumObjects

public int getNumObjects()
Return the number of top-level objects in the collection.


isEmpty

public boolean isEmpty()
Return true if there are no objects in the collection.


getFirstObjectPos

public JGoListPosition getFirstObjectPos()
Return the position of the first object in the collection. This will be null if the list is empty.


getNextObjectPos

public JGoListPosition getNextObjectPos(JGoListPosition pos)
Return the position for the next object in the collection. This may recurse through the objects contained by a JGoArea.

Parameters:
pos - the position previous to that which will be returned.
Returns:
an iterator for the next object in the collection; null if there are no more objects.

getNextObjectPosAtTop

public JGoListPosition getNextObjectPosAtTop(JGoListPosition pos)
Return the position for the next top-level object in the collection. A top-level JGoObject is one which is not contained in any JGoArea objects.

Parameters:
pos - the position from which to start searching for the next top-level object.
Returns:
an iterator for the next top-level object in the collection; null if there are no more objects.

getObjectAtPos

public JGoObject getObjectAtPos(JGoListPosition pos)
Return the object for the given position.

Parameters:
pos - the position of an object in the collection.
Returns:
the object for this position in the collection.