public class InlineAlternative extends Guard
Alternative
s to be nested.Modifier and Type | Field and Description |
---|---|
private Alternative |
alt
If used as a top level ALT, the work will be delegated to this
|
private int |
favourite
Index to favour (fair / pri)
|
private Guard[] |
guard
The guards
|
private InlineAlternative[] |
ialts
Nested ALTs
|
private long |
minAlarm
Shortest alarm set by a timer
|
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.
|
private boolean[] |
preconditions
The preconditions set for the ALT when it is being used as a guard.
|
private int |
selected
Index last selected
|
private int |
selectMode
Mode of the select
|
private int |
timeoutIndex
Timeout index
|
private CSTimer[] |
timers
The timer guards
|
Constructor and Description |
---|
InlineAlternative(Guard[] guards)
Creates a new one
|
InlineAlternative(Guard[] guards,
int mode)
Creates a new one
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
disable()
Disable this ALT as a guard within its parent ALT.
|
(package private) boolean |
enable(Alternative alt)
Enable this ALT as a guard within its parent ALT.
|
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().
|
public static final int MODE_ARBITRARY
public static final int MODE_FAIR
public static final int MODE_PRI
private Alternative alt
private int selectMode
private int selected
private int favourite
private boolean[] preconditions
private final Guard[] guard
private final CSTimer[] timers
private final InlineAlternative[] ialts
private int timeoutIndex
private long minAlarm
public InlineAlternative(Guard[] guards)
public InlineAlternative(Guard[] guards, int mode)
public int getSelected()
public void setPreconditions(boolean[] precons)
public void setPreconditionByIndex(int index, boolean on)
public Guard getSelectedGuard()
public Guard getGuardByIndex(int index)
public int select()
public int priSelect()
public int fairSelect()
boolean enable(Alternative alt)