JAL-3438 spotless for 2.11.2.0
[jalview.git] / src / jalview / analysis / scoremodels / FeatureDistanceModel.java
index c20d4f1..9c2f6d1 100644 (file)
@@ -58,7 +58,7 @@ public class FeatureDistanceModel extends DistanceScoreModel
     FeatureDistanceModel instance;
     try
     {
-      instance = this.getClass().newInstance();
+      instance = this.getClass().getDeclaredConstructor().newInstance();
       instance.configureFromAlignmentView(view);
       return instance;
     } catch (InstantiationException | IllegalAccessException e)
@@ -66,6 +66,9 @@ public class FeatureDistanceModel extends DistanceScoreModel
       System.err.println("Error in " + getClass().getName()
               + ".getInstance(): " + e.getMessage());
       return null;
+    } catch (ReflectiveOperationException roe)
+    {
+      return null;
     }
   }
 
@@ -177,24 +180,29 @@ public class FeatureDistanceModel extends DistanceScoreModel
   /**
    * Builds and returns a map containing a (possibly empty) list (one per
    * SeqCigar) of visible feature types at the given column position. The map
-   * has no entry for sequences which are gapped at the column position.
+   * does not include entries for features which straddle a gapped column
+   * positions.
    * 
    * @param seqs
    * @param columnPosition
+   *          (0..)
    * @return
    */
   protected Map<SeqCigar, Set<String>> findFeatureTypesAtColumn(
           SeqCigar[] seqs, int columnPosition)
   {
-    Map<SeqCigar, Set<String>> sfap = new HashMap<SeqCigar, Set<String>>();
+    Map<SeqCigar, Set<String>> sfap = new HashMap<>();
     for (SeqCigar seq : seqs)
     {
       int spos = seq.findPosition(columnPosition);
       if (spos != -1)
       {
-        Set<String> types = new HashSet<String>();
-        List<SequenceFeature> sfs = fr.findFeaturesAtRes(seq.getRefSeq(),
-                spos);
+        /*
+         * position is not a gap
+         */
+        Set<String> types = new HashSet<>();
+        List<SequenceFeature> sfs = fr
+                .findFeaturesAtResidue(seq.getRefSeq(), spos, spos);
         for (SequenceFeature sf : sfs)
         {
           types.add(sf.getType());