|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.domains.csp.kernel.AbstractBranchController
public abstract class AbstractBranchController
This is a base class containing the common code for controllers that manage branches for performing conditional or multiway rendezvous within the CSP (Communication Sequential Processes) domain. Any CSP actors (either atomic or composite) that multiway rendezvous should contain an instance of this class. In addition, they also needs to implement the BranchActor interface.
ConditionalBranch
,
BranchActor
,
ConditionalReceive
,
ConditionalSend
Red (bilung) |
Yellow (eal) |
Field Summary | |
---|---|
protected ConditionalBranch[] |
_branches
The set of branches currently being chosen from in chooseBranch(). |
protected int |
_branchesActive
The number of conditional branches that are still active, meaning that they are capable of succeeding. |
protected boolean |
_debugging
Flag that is true if there are debug listeners. |
private java.util.LinkedList |
_debugListeners
The list of DebugListeners registered with this object. |
private Actor |
_parentActor
The actor who owns this controller. |
protected java.util.LinkedList |
_threadList
List of threads created by this actor to perform a conditional rendezvous. |
Constructor Summary | |
---|---|
AbstractBranchController(Actor container)
Construct a controller in the specified container, which should be an actor that implements BranchActor. |
Method Summary | |
---|---|
protected void |
_branchBlocked(CSPReceiver receiver)
Notify the director that the current thread is blocked. |
protected void |
_branchFailed(int branchNumber)
Register the calling branch as failed. |
protected abstract void |
_branchNotReady(int branchNumber)
Indicate that the branch is not ready to rendezvous. |
protected void |
_branchSucceeded(int branchID)
Register the calling branch as a successful branch. |
protected void |
_branchUnblocked(CSPReceiver receiver)
Notify the director that the current thread is unblocked. |
protected void |
_debug(java.lang.String message)
Send a debug message to all debug listeners that have registered. |
protected CSPDirector |
_getDirector()
Get the director that controls the execution of its parent actor. |
protected abstract boolean |
_isBranchReady(int branchNumber)
Called by ConditionalSend and ConditionalReceive to check whether the calling branch is ready to rendezvous. |
void |
addDebugListener(DebugListener listener)
Add a debug listener. |
Actor |
getParent()
Return the Actor that creates the branch and owns this controller when performing a CIF or CDO. |
void |
removeDebugListener(DebugListener listener)
Unregister a debug listener. |
void |
terminate()
Terminate abruptly any threads created by this actor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ConditionalBranch[] _branches
protected int _branchesActive
protected boolean _debugging
protected java.util.LinkedList _threadList
private java.util.LinkedList _debugListeners
private Actor _parentActor
Constructor Detail |
---|
public AbstractBranchController(Actor container)
container
- The parent actor that contains this object.Method Detail |
---|
public void addDebugListener(DebugListener listener)
addDebugListener
in interface Debuggable
listener
- The listener to which to send debug messages.removeDebugListener(DebugListener)
public Actor getParent()
public void removeDebugListener(DebugListener listener)
removeDebugListener
in interface Debuggable
listener
- The listener to remove from the list of listeners
to which debug messages are sent.addDebugListener(DebugListener)
public void terminate()
protected void _branchBlocked(CSPReceiver receiver)
receiver
- The receiver handling the I/O operation,
or null if it is not a specific receiver.protected void _branchFailed(int branchNumber)
branchNumber
- The ID assigned to the calling branch
upon creation.protected abstract void _branchNotReady(int branchNumber)
branchNumber
- The ID assigned to the branch upon creation.protected void _branchSucceeded(int branchID)
branchID
- The ID assigned to the calling branch upon creation.protected void _branchUnblocked(CSPReceiver receiver)
receiver
- The receiver handling the I/O operation,
or null if it is not a specific receiver.protected final void _debug(java.lang.String message)
message
- The message.protected CSPDirector _getDirector()
protected abstract boolean _isBranchReady(int branchNumber)
branchNumber
- The ID assigned to the calling branch
upon creation.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |