-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathAlt.java
More file actions
107 lines (94 loc) · 2.24 KB
/
Copy pathAlt.java
File metadata and controls
107 lines (94 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package JyCSP;
import org.python.core.*;
import JyCSP.Interfaces.JyCspAltInterface;
import JyCSP.util.CspFactory;
/**
*
* @author Sam Wilson, Sarah Mount
* @version 1.0
*
* Java representation of the Jython Class ALT.
*
*
*
*/
public class Alt extends PyObject implements JyCspAltInterface {
/**
* Java ALT Interface for the Jython Class ALT.
*/
protected JyCspAltInterface jcsi;
/**
* Default Constructor.
* Make a Call to the static method createJavaCspAlt in
* the CspFactory Class
*
* @param args List of Guards for the ALT to Select from.
*/
public Alt(PyObject... args) {
super();
this.jcsi = CspFactory.createJavaCspAlt(args);
}
/**
* Straight through call to Poison method in the Jython Class
*
* Causes a Channel to be poisoned, Data can not be sent down
* a poisoned channel.
*/
public void poison() {
this.jcsi.poison();
}
/**
* Straight through call to pri_select method in the Jython Class
*
* Select a guard to synchronise with, in order of
* "priority". The guard with the lowest index in the guards
* list has the highest priority
*/
public Object pri_select() {
return this.jcsi.pri_select();
}
/**
* Straight through call to the select method in the Jython Class
*
* Randomly select from ready guards.
*
*/
public Object select() {
return this.jcsi.select();
}
/**
* Straight through call to the fair_select method in the Jython Class
*
* Select a guard to synchronise with. Do not select the
* previously selected guard (unless it is the only guard
* available).
*/
public Object fair_select() {
return this.jcsi.fair_select();
}
/**
* Allow access to the Jython variable.
*
* @return last selected Channel from this ALT
*/
public Object last_selected() {
return this.jcsi.last_selected();
}
/**
* Allows access to the list of guards within the Jython Class
*
* @return true if the list of guards is greater than 0
* false otherwise
*/
public boolean hasNext() {
return this.jcsi.hasNext();
}
/**
* Allows access to list of guards within the Jython Class
*
* @return int representing the number of guards in this ALT
*/
public int getGuardLength() {
return this.jcsi.getGuardLength();
}
}