fr_b02 / petri / src / arcElement / ArcEntering.java @ 6
Historique | Voir | Annoter | Télécharger (933 octets)
1 | 4 | a19coudr | package arcElement; |
---|---|---|---|
2 | 2 | a19coudr | |
3 | 3 | a19coudr | import element.Place; |
4 | |||
5 | 2 | a19coudr | public class ArcEntering extends Arc{ |
6 | |||
7 | private int value; |
||
8 | 6 | a19coudr | /**
|
9 | * @param the place link to ArcEntering and the value of this Arc
|
||
10 | * Constructor for ArcEntering
|
||
11 | *
|
||
12 | */
|
||
13 | 2 | a19coudr | public ArcEntering(Place place, int value) { |
14 | super(place);
|
||
15 | 4 | a19coudr | |
16 | 2 | a19coudr | this.value=value;
|
17 | } |
||
18 | 6 | a19coudr | /**
|
19 | * Do the transition for the ArcEntering (add to the place value token)
|
||
20 | *
|
||
21 | */
|
||
22 | 2 | a19coudr | public void doTransition() { |
23 | this.getPlace().changeToken(this.value); |
||
24 | } |
||
25 | 6 | a19coudr | /**
|
26 | * Check if the ArcEntering is active (always true)
|
||
27 | *@return true
|
||
28 | */
|
||
29 | 2 | a19coudr | public boolean isActive() { |
30 | return true; |
||
31 | } |
||
32 | 6 | a19coudr | /**
|
33 | * Check if the ArcEntering is Pullable (always true)
|
||
34 | *@return true
|
||
35 | */
|
||
36 | 2 | a19coudr | public boolean isPullable() { |
37 | return true; |
||
38 | } |
||
39 | 6 | a19coudr | /**
|
40 | * @return a string that describe the ArcEntering
|
||
41 | *
|
||
42 | */
|
||
43 | 2 | a19coudr | public String toString() { |
44 | return "ArcEntering value:"+value+", "+this.getPlace(); |
||
45 | } |
||
46 | |||
47 | 4 | a19coudr | |
48 | 2 | a19coudr | |
49 | |||
50 | } |