Révision 6 petri/src/arcElement/Arc.java
Arc.java | ||
---|---|---|
3 | 3 |
import element.Place; |
4 | 4 |
import junit.framework.TestCase; |
5 | 5 |
|
6 |
/** |
|
7 |
* Abstract class for the arc |
|
8 |
* |
|
9 |
*/ |
|
6 | 10 |
public abstract class Arc extends TestCase implements ArcInterface { |
7 |
|
|
11 |
|
|
8 | 12 |
private Place place; |
9 |
|
|
13 |
/** |
|
14 |
* @param place link to the arc |
|
15 |
* |
|
16 |
*/ |
|
10 | 17 |
public Arc(Place place) { |
11 | 18 |
this.place=place; |
12 | 19 |
} |
13 |
|
|
14 | 20 |
public Place getPlace() { |
15 | 21 |
return this.place; |
16 | 22 |
} |
23 |
/** |
|
24 |
* @param Object to compare to the arc |
|
25 |
*the goal of this method is to check if two arcs are the same object (same identityHashCode) |
|
26 |
*/ |
|
17 | 27 |
public boolean equals(Object o) { |
18 | 28 |
if((o instanceof Arc) &&(System.identityHashCode(((Arc)o))==System.identityHashCode(this))) { |
19 | 29 |
return true; |
... | ... | |
21 | 31 |
else { |
22 | 32 |
return false; |
23 | 33 |
} |
24 |
|
|
34 |
|
|
25 | 35 |
} |
26 | 36 |
|
27 | 37 |
} |
Formats disponibles : Unified diff