edu.mit.ai.psg.traveler
Class ActivityRecordObservableBase

java.lang.Object
  |
  +--edu.mit.ai.psg.traveler.ActivityRecordBase
        |
        +--edu.mit.ai.psg.traveler.ActivityRecordObservableBase
Direct Known Subclasses:
StringRecordObservable

public abstract class ActivityRecordObservableBase
extends ActivityRecordBase
implements ObservableRecord

Base class for records which will be observed. Designed around the following assumptions: (1) activity records may number in the hundreds of thousands or more, so minimizing space is a concern; (2) once activity has finished, record will no longer change; thus observers are only kept for activities in progress. To mark activity as finished, call finished()(); to test whether it is subject to change, test isReadOnly()().


Fields inherited from class edu.mit.ai.psg.traveler.ActivityRecordBase
parent
 
Constructor Summary
ActivityRecordObservableBase()
           
 
Method Summary
 void addChangeObserver(ChangeObserver observer)
          arrange to be notified as follows: parent set: observer.notifyChanged(thisRecord)
child added: observer.notifyAdded(thisRecord, childRecord)
 void addChild(ActivityRecord child)
          add child to this parent's children, and set child's parent to this
 void finished()
          Trims child list (or sets to null if empty).
 boolean isReadOnly()
          may be used to avoid constructing change observers for records that will never change.
 void removeChangeObserver(ChangeObserver observer)
           
 void setParent(ActivityRecord parentRecord)
          called by addChild
 
Methods inherited from class edu.mit.ai.psg.traveler.ActivityRecordBase
addThreadedChild, cloneObject, ensureListValue, getChildren, getChildrenInThread, getParent, getProperty, getThreadedChildren, isFinished, putProperty, removeProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActivityRecordObservableBase

public ActivityRecordObservableBase()
Method Detail

finished

public void finished()
Description copied from class: ActivityRecordBase
Trims child list (or sets to null if empty).
Overrides:
finished in class ActivityRecordBase

isReadOnly

public boolean isReadOnly()
Description copied from interface: ObservableRecord
may be used to avoid constructing change observers for records that will never change. If true, should never become false. (Often different from ActivityRecord.isFinished(), which only means the thread that created the activity record is finished with it, not that other threads are.)
Specified by:
isReadOnly in interface ObservableRecord

setParent

public void setParent(ActivityRecord parentRecord)
Description copied from interface: ActivityRecord
called by addChild
Overrides:
setParent in class ActivityRecordBase

addChild

public void addChild(ActivityRecord child)
Description copied from interface: ActivityRecord
add child to this parent's children, and set child's parent to this
Overrides:
addChild in class ActivityRecordBase
Tags copied from interface: ActivityRecord
See Also:
ActivityRecord.addThreadedChild(edu.mit.ai.psg.traveler.ActivityRecord)

addChangeObserver

public void addChangeObserver(ChangeObserver observer)
arrange to be notified as follows:
Specified by:
addChangeObserver in interface ObservableRecord

removeChangeObserver

public void removeChangeObserver(ChangeObserver observer)
Specified by:
removeChangeObserver in interface ObservableRecord

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu