org.jcsp.nxt.lang
Class Guard

java.lang.Object
  extended by org.jcsp.nxt.lang.Guard
Direct Known Subclasses:
AltingChannelInput, AltingChannelInputInt, CSTimer, Skip

public abstract class Guard
extends java.lang.Object

This is the super-class for all Alternative events selectable by a process.

Description

Guard defines an abstract interface to be implemented by events competing for selection by a process executing an Alternative. Its methods have only package visibility within org.jcsp.nxt.lang and are of no concern to users of this package. Currently, JCSP supports channel inputs as guards.

Note: for those familiar with the occam multiprocessing language, classes implementing Guard correspond to process guards for use within ALT constructs.

Author:
P.D.Austin, P.H.Welch, Alex Panayotopoulos
See Also:
AltingChannelInputInt, Alternative

Constructor Summary
Guard()
           
 
Method Summary
(package private) abstract  boolean disable()
          Disables the guard for selection.
(package private) abstract  boolean enable(Alternative alt)
          Returns true if the event is ready.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Guard

public Guard()
Method Detail

enable

abstract boolean enable(Alternative alt)
Returns true if the event is ready. Otherwise, this enables the guard for selection and returns false.

Note: this method should only be called by the Alternative class

Parameters:
alt - the Alternative class that is controlling the selection
Returns:
true if and only if the event is ready

disable

abstract boolean disable()
Disables the guard for selection. Returns true if the event was ready.

Note: this method should only be called by the Alternative class

Returns:
true if and only if the event was ready