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