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