JAL-3210 Improvements to eclipse detection. New src tree and SwingJS updated from...
[jalview.git] / src / jalview / analysis / scoremodels / SimilarityParams.java
index 58b08dd..69ca403 100644 (file)
@@ -104,6 +104,7 @@ public class SimilarityParams implements SimilarityParamsI
 
   private boolean denominateByShortestLength;
 
+
   /**
    * Constructor
    * 
@@ -124,6 +125,19 @@ public class SimilarityParams implements SimilarityParamsI
     denominateByShortestLength = shortestLength;
   }
 
+  /**
+   * BH added a non-Groovy "standard" set for JalviewJS
+   * 
+   * @param isPCA
+   */
+  public SimilarityParams(boolean isPCA)
+  {
+    includeGappedColumns = true;
+    matchGaps = !isPCA;
+    includeGaps = true;
+    denominateByShortestLength = false;
+  }
+
   @Override
   public boolean includeGaps()
   {
@@ -147,4 +161,57 @@ public class SimilarityParams implements SimilarityParamsI
   {
     return matchGaps;
   }
+
+  /**
+   * IDE-generated hashCode method
+   */
+  @Override
+  public int hashCode()
+  {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + (denominateByShortestLength ? 1231 : 1237);
+    result = prime * result + (includeGappedColumns ? 1231 : 1237);
+    result = prime * result + (includeGaps ? 1231 : 1237);
+    result = prime * result + (matchGaps ? 1231 : 1237);
+    return result;
+  }
+
+  /**
+   * IDE-generated equals method
+   */
+  @Override
+  public boolean equals(Object obj)
+  {
+    if (this == obj)
+    {
+      return true;
+    }
+    if (obj == null)
+    {
+      return false;
+    }
+    if (getClass() != obj.getClass())
+    {
+      return false;
+    }
+    SimilarityParams other = (SimilarityParams) obj;
+    if (denominateByShortestLength != other.denominateByShortestLength)
+    {
+      return false;
+    }
+    if (includeGappedColumns != other.includeGappedColumns)
+    {
+      return false;
+    }
+    if (includeGaps != other.includeGaps)
+    {
+      return false;
+    }
+    if (matchGaps != other.matchGaps)
+    {
+      return false;
+    }
+    return true;
+  }
 }