예제 #1
0
 @Override
 public int compareTo(Object o) {
   Platform t = (Platform) o;
   if (getPlatformId() < t.getPlatformId()) return -1;
   if (getPlatformId() > t.getPlatformId()) return 1;
   return 0;
 }
예제 #2
0
 /**
  * Equivalency is based on getProjectId() if set, otherwise on name, description and creation
  * date.
  */
 @Override
 public boolean equals(Object obj) {
   if (obj == null) return false;
   if (obj == this) return true;
   if (!(obj instanceof Platform)) return false;
   Platform them = (Platform) obj;
   // If not saved, then compare resolved actual objects. Otherwise
   // just compare IDs.
   if (getPlatformId() == AbstractPlatform.UNSAVED_ID
       || them.getPlatformId() == AbstractPlatform.UNSAVED_ID) {
     return getPlatformType().equals(them.getPlatformType())
         && getDescription().equals(them.getDescription());
   } else {
     return getPlatformId().longValue() == them.getPlatformId().longValue();
   }
 }