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