X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fanalysis%2Fscoremodels%2FSimilarityParams.java;h=69ca4035ec09e0f0c5078257f72627eb72b144bd;hb=a83adb45bdf9554e270921b4baad94defd314b36;hp=e5751ca6e61d6aac1a3eb1b7a3ccef14820d8689;hpb=136c0793b90b72b928c4d77dc109dd5c644e00d3;p=jalview.git diff --git a/src/jalview/analysis/scoremodels/SimilarityParams.java b/src/jalview/analysis/scoremodels/SimilarityParams.java index e5751ca..69ca4035 100644 --- a/src/jalview/analysis/scoremodels/SimilarityParams.java +++ b/src/jalview/analysis/scoremodels/SimilarityParams.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.analysis.scoremodels; import jalview.api.analysis.SimilarityParamsI; @@ -20,8 +40,8 @@ public class SimilarityParams implements SimilarityParamsI * Based on Jalview's Comparison.PID method, which includes gaps and counts * them as matching; it counts over the length of the shorter sequence */ - public static final SimilarityParamsI Jalview = new SimilarityParams( - true, true, true, true); + public static final SimilarityParamsI Jalview = new SimilarityParams(true, + true, true, true); /** * 'SeqSpace' mode PCA calculation includes gaps but does not count them as @@ -84,6 +104,7 @@ public class SimilarityParams implements SimilarityParamsI private boolean denominateByShortestLength; + /** * Constructor * @@ -104,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() { @@ -127,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; + } }