edu.mit.ai.psg.traveler
Class ActivityRecordMethods.IteratorBase

java.lang.Object
  |
  +--edu.mit.ai.psg.traveler.ActivityRecordMethods.IteratorBase
Direct Known Subclasses:
ActivityRecordMethods.BiographyIterator, ActivityRecordMethods.SuperactivityIterator, ActivityRecordMethods.ThreadIterator
Enclosing class:
ActivityRecordMethods

public abstract static class ActivityRecordMethods.IteratorBase
extends Object
implements ActivityRecordMethods.Iterator

Abstract base class for ActivityRecord iterators; derived classes add method to computeNext()


Field Summary
protected  boolean isAtEntrance
          isAtEntrance is true if the activity to be returned next will be returned for its entrance.
protected  ActivityRecord record
           
protected  boolean recordIsNext
          true if record holds next record to return; otherwise record holds last record returned, and computeNext() will be called to compute the next record from the last record and set record to it.
 
Constructor Summary
ActivityRecordMethods.IteratorBase(ActivityRecord startRecord, boolean atEntrance, boolean startRecordIsFirst)
           
 
Method Summary
protected abstract  void computeNext()
          method called by hasNext() and next() to compute the next activity record if the current record has already been returned
 boolean hasNext()
           
 boolean isAtEntrance()
          for iterators that return each activity twice, once for when the thread entered the activity, and once for when it exited.
 Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

record

protected ActivityRecord record

recordIsNext

protected boolean recordIsNext
true if record holds next record to return; otherwise record holds last record returned, and computeNext() will be called to compute the next record from the last record and set record to it.

isAtEntrance

protected boolean isAtEntrance
isAtEntrance is true if the activity to be returned next will be returned for its entrance.
Constructor Detail

ActivityRecordMethods.IteratorBase

public ActivityRecordMethods.IteratorBase(ActivityRecord startRecord,
                                          boolean atEntrance,
                                          boolean startRecordIsFirst)
Method Detail

hasNext

public boolean hasNext()

next

public Object next()

computeNext

protected abstract void computeNext()
method called by hasNext() and next() to compute the next activity record if the current record has already been returned

remove

public void remove()
Throws:
UnsupportedOperationException -  

isAtEntrance

public boolean isAtEntrance()
Description copied from interface: ActivityRecordMethods.Iterator
for iterators that return each activity twice, once for when the thread entered the activity, and once for when it exited. isAtEntrance returns true if the activity to be returned next will be returned for its entrance.
Specified by:
isAtEntrance in interface ActivityRecordMethods.Iterator
Tags copied from interface: ActivityRecordMethods.Iterator
Throws:
NoSuchElementException - if there are no more activities

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu