Module org.bzdev.drama
Package org.bzdev.drama.common
Class CondObserverImpl<C extends GenericCondition,P extends SimObject>
java.lang.Object
org.bzdev.drama.generic.GenericCondObsrvrImpl<C,P>
org.bzdev.drama.common.CondObserverImpl<C,P>
public abstract class CondObserverImpl<C extends GenericCondition,P extends SimObject>
extends GenericCondObsrvrImpl<C,P>
Implement a condition observer.
A class implementing CondObserver when the type parameter C is
Condition and the type parameter P is OurSimObject will typically
declare a field
CondObserverImpl<Condition,OurSimObject> impl = new CondObserverImpl<Condition,OurSimObject>(this) { protected void doConditionChange(Condition c, ConditionMode mode, SimObject source) { ... } };followed by a series of method declarations such as
public boolean addCondition(Condition c) { return impl.addCondition(c); }for each public method of CondObserver. The use of an anonymous inner class allows the doConditionChange method to be defined so that the class implementing CondObserver can respond to a change in a condition. While there is a default implementation for doConditionChange(Map<Condition,ConditionInfo> cMap), which is used when condition change notifications are queued, it may be necessary to provide an implementation of this method for efficiency reasons (as is done in the Generic Domain classes).
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.bzdev.drama.generic.GenericCondObsrvrImpl
addCondition, conditionSet, doConditionChange, doConditionChange, getConditionChangeQMode, getParent, hasCondition, removeAllConditions, removeCondition, setConditionChangeQMode, setCondObserverImpl, transformedMode
-
Constructor Details
-
CondObserverImpl
Constructor.- Parameters:
parent
- a simulation object (SimObject) that implements CondObserver
-