fr_b02 / petri / src / element / Transition.java @ 4
Historique | Voir | Annoter | Télécharger (836 octets)
1 |
package element; |
---|---|
2 |
|
3 |
import java.util.ArrayList; |
4 |
import java.util.List; |
5 |
|
6 |
import arcElement.Arc; |
7 |
|
8 |
|
9 |
public class Transition { |
10 |
|
11 |
|
12 |
private List<Arc> arcList; |
13 |
|
14 |
public String toString() { |
15 |
String res= " ["; |
16 |
for(int i=0;arcList.size()>i;i++ ) { |
17 |
res=res+arcList.get(i).toString()+" // ";
|
18 |
} |
19 |
res=res+"] ";
|
20 |
return res;
|
21 |
} |
22 |
|
23 |
public Transition() {
|
24 |
this.arcList=new ArrayList<Arc>(); |
25 |
} |
26 |
|
27 |
|
28 |
public boolean isPullable() { |
29 |
int i=0; |
30 |
boolean res=true; |
31 |
while(i<this.arcList.size() && res==true) { |
32 |
res=this.arcList.get(i).isPullable();
|
33 |
i=i+1;
|
34 |
} |
35 |
return res;
|
36 |
} |
37 |
|
38 |
public void doTransition() { |
39 |
if (this.isPullable()==true) { |
40 |
for (int i=0; i<arcList.size();i++) { |
41 |
arcList.get(i).doTransition(); |
42 |
} |
43 |
} |
44 |
} |
45 |
public List<Arc> getArcList(){ |
46 |
return this.arcList; |
47 |
} |
48 |
|
49 |
|
50 |
} |