public abstract class AbstractBranchController extends java.lang.Object implements Debuggable
ConditionalBranch
,
BranchActor
,
ConditionalReceive
,
ConditionalSend
Red (bilung) |
Yellow (eal) |
Modifier and Type | Field and Description |
---|---|
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.
|
protected java.util.LinkedList |
_threadList
List of threads created by this actor to perform a conditional rendezvous.
|
Constructor and Description |
---|
AbstractBranchController(Actor container)
Construct a controller in the specified container, which should
be an actor that implements BranchActor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected ConditionalBranch[] _branches
protected int _branchesActive
protected boolean _debugging
protected java.util.LinkedList _threadList
public AbstractBranchController(Actor container)
container
- The parent actor that contains this object.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.