Statistiques
| Révision:

fr_b02 / petri / src / arcElement / ArcOutering.java @ 7

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

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