Exemple #1
0
 /**
  * Compares this Gene with the given object and returns true if the other object is a Gene of the
  * same type and has the same value (allele) as this Gene. Otherwise it returns false.
  *
  * @param a_other the object to compare to this Gene for equality
  * @return true if this Gene is equal to the given object, false otherwise
  * @author Klaus Meffert
  * @since 1.1
  */
 public boolean equals(final Object a_other) {
   try {
     int result = compareTo(a_other);
     if (result == 0) {
       if (isCompareApplicationData()) {
         Gene otherGene = (Gene) a_other;
         int resultAppData =
             compareApplicationData(getApplicationData(), otherGene.getApplicationData());
         return resultAppData == 0;
       } else {
         return true;
       }
     } else {
       return false;
     }
   } catch (ClassCastException e) {
     // If the other object isn't an Gene of current type
     // (like IntegerGene for IntegerGene's), then we're not equal.
     // -----------------------------------------------------------
     return false;
   }
 }