Révision 7 petri/src/element/Place.java

Voir les différences:

Place.java
1 1
package element;
2 2

  
3 3

  
4

  
5 4
public class Place {
6 5
	
7 6
	private int token;
8
	
7
	/**
8
	 * exception to handle negative value for token
9
	 */
9 10
	@SuppressWarnings("serial")
10 11
	public class UndefinedToken extends Exception{
11 12
		public UndefinedToken() {
......
24 25
	public int getToken() {
25 26
		return this.token;
26 27
	}
28
	/**
29
	 * @return a string representation of the place
30
	 */
27 31
	public String toString() {
28 32
		return "Place Token : "+token;
29 33
	}
30
	
34
	/**
35
	 * check if the place is not empty
36
	 */
31 37
	public boolean isEmpty() {
32 38
		return (this.token==0);
33 39
	}
34
	
40
	/**
41
	 * @param int value that the place has to add  to its token value
42
	 */
35 43
	public void changeToken(int i) {
36 44
		token += i;
37 45
	}
38
	
46
	/**
47
	 * @param Object to compare to the place
48
	 *the goal of this method is to check if two places are the same object (same identityHashCode)
49
	 */
39 50
	public boolean equals(Object o) {
40 51
		if((o instanceof Place) &&(System.identityHashCode(((Place)o))==System.identityHashCode(this))) {
41 52
			return true;

Formats disponibles : Unified diff