Statistiques
| Révision:

fr_b02 / petri / src / arcElement / ArcCleaner.java @ 6

Historique | Voir | Annoter | Télécharger (981 octets)

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