예제 #1
0
 @Override
 public boolean equals(Object obj) {
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   final Marking other = (Marking) obj;
   if (this.petriNet != other.petriNet
       && (this.petriNet == null || !this.petriNet.equals(other.petriNet))) {
     return false;
   }
   if (this.map == other.map) {
     return true;
   }
   Set<Place> places = new HashSet<Place>(); // because map is sparse
   places.addAll(this.map.keySet());
   places.addAll(other.map.keySet());
   for (Place place : places) {
     if (this.getTokens(place) != other.getTokens(place)) {
       return false;
     }
   }
   return true;
 }