Module org.bzdev.drama
Package org.bzdev.drama.common
Interface CondObserver<C extends GenericCondition,P extends SimObject>
- All Known Implementing Classes:
Actor
,Domain
,GenericActor
,GenericDomain
public interface CondObserver<C extends GenericCondition,P extends SimObject>
Interface for classes that can observe conditions.
The implementation of the methods defined by this interface must
delegate their implementations to an instance of
CondObserverImpl, which contains package-private methods for
interacting with conditions. The documentation for CondObserverImpl
explains how this is done.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addCondition
(C c) Associate a condition with an observer.Get a set of conditionsboolean
Determine if condition-change notifications are queued.Get the condition-observer implementation for a condition observer.boolean
hasCondition
(C c) Determine if a condition observer has (is associated with) a condition.boolean
removeCondition
(C c) Disassociate a condition with a condition observer.void
setConditionChangeQMode
(boolean value) Set whether condition-change notifications should be queued or sent immediately.
-
Method Details
-
getCondObserverImpl
CondObserverImpl<C,P> getCondObserverImpl()Get the condition-observer implementation for a condition observer. This method is intended for use by classes in the org.bzdev.drama.generic package.- Returns:
- the condition-observer implementation
-
addCondition
Associate a condition with an observer.- Parameters:
c
- the condition- Returns:
- true on success; false on failure
-
removeCondition
Disassociate a condition with a condition observer.- Parameters:
c
- the condition- Returns:
- true on success; false on failure
-
hasCondition
Determine if a condition observer has (is associated with) a condition.- Parameters:
c
- the condition- Returns:
- true if the condition observer has condition c; false otherwise
-
conditionSet
Get a set of conditions- Returns:
- the set of conditions that are associated with this condition observer
-
setConditionChangeQMode
void setConditionChangeQMode(boolean value) Set whether condition-change notifications should be queued or sent immediately. Setting this mode to true will improve performance when many conditions are changed at the same simulation time. If the mode is changed from true to false while there are some queued notifications, those will be forwarded.- Parameters:
value
- true if notifications should be queued; false if they should be sent immediately.
-
getConditionChangeQMode
boolean getConditionChangeQMode()Determine if condition-change notifications are queued.- Returns:
- true if queued; false otherwise.
-