CSP for Java
(JCSP) 1.1-rc4

org.jcsp.lang
Class InlineAlternative

java.lang.Object
  extended by org.jcsp.lang.Guard
      extended by org.jcsp.lang.InlineAlternative

public class InlineAlternative
extends Guard

This class is experimental (i.e. not properly documented yet). It is intended to allow Alternatives to be nested.

Author:
Quickstone Technologies Limited

Field Summary
static int MODE_ARBITRARY
          Flags to control behaviour of this ALT if used as a guard.
static int MODE_FAIR
          Flags to control behaviour of this ALT if used as a guard.
static int MODE_PRI
          Flags to control behaviour of this ALT if used as a guard.
 
Constructor Summary
InlineAlternative(Guard[] guards)
          Creates a new one
InlineAlternative(Guard[] guards, int mode)
          Creates a new one
 
Method Summary
 int fairSelect()
          Creates an Alternative (if needed) and delegates the call to it.
 Guard getGuardByIndex(int index)
          Returns the guard object at a given index.
 int getSelected()
          Returns the index of the guard obtained by a call to select() or if this guard became ready within its parent ALT.
 Guard getSelectedGuard()
          Returns the actual guard object corresponding to the selected guard.
 int priSelect()
          Creates an Alternative (if needed) and delegates the call to it.
 int select()
          Creates an Alternative (if needed) and delegates the call to it.
 void setPreconditionByIndex(int index, boolean on)
          Alters the precondition on a guard.
 void setPreconditions(boolean[] precons)
          Establishes a precondition array that will be used by default in calls to select().
 
Methods inherited from class org.jcsp.lang.Guard
schedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_ARBITRARY

public static final int MODE_ARBITRARY
Flags to control behaviour of this ALT if used as a guard.

See Also:
Constant Field Values

MODE_FAIR

public static final int MODE_FAIR
Flags to control behaviour of this ALT if used as a guard.

See Also:
Constant Field Values

MODE_PRI

public static final int MODE_PRI
Flags to control behaviour of this ALT if used as a guard.

See Also:
Constant Field Values
Constructor Detail

InlineAlternative

public InlineAlternative(Guard[] guards)
Creates a new one


InlineAlternative

public InlineAlternative(Guard[] guards,
                         int mode)
Creates a new one

Method Detail

getSelected

public int getSelected()
Returns the index of the guard obtained by a call to select() or if this guard became ready within its parent ALT.


setPreconditions

public void setPreconditions(boolean[] precons)
Establishes a precondition array that will be used by default in calls to select(). This is useful when the ALT is used as a guard within another ALT.


setPreconditionByIndex

public void setPreconditionByIndex(int index,
                                   boolean on)
Alters the precondition on a guard.


getSelectedGuard

public Guard getSelectedGuard()
Returns the actual guard object corresponding to the selected guard. For example it can return the channel or the ALT object.


getGuardByIndex

public Guard getGuardByIndex(int index)
Returns the guard object at a given index. For example to obtain a channel or ALT object.


select

public int select()
Creates an Alternative (if needed) and delegates the call to it.


priSelect

public int priSelect()
Creates an Alternative (if needed) and delegates the call to it.


fairSelect

public int fairSelect()
Creates an Alternative (if needed) and delegates the call to it.


CSP for Java
(JCSP) 1.1-rc4

Submit a bug or feature to jcsp-team@kent.ac.uk
Version 1.1-rc4 of the JCSP API Specification (Copyright 1997-2008 P.D.Austin and P.H.Welch - All Rights Reserved)
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.