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