explicit Hashtable objects
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Thu, 18 Apr 2019 03:54:33 +0000 (22:54 -0500)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Thu, 18 Apr 2019 03:54:33 +0000 (22:54 -0500)
src/jalview/analysis/AAFrequency.java
src/jalview/analysis/StructureFrequency.java
src/jalview/api/AlignViewportI.java
src/jalview/io/FileLoader.java
src/jalview/jbgui/GAlignmentPanel.java
src/jalview/renderer/AnnotationRenderer.java
src/jalview/viewmodel/AlignmentViewport.java
src/jalview/workers/ComplementConsensusThread.java
src/jalview/workers/ConsensusThread.java

index a1b0325..61f3b7f 100755 (executable)
@@ -482,7 +482,8 @@ public class AAFrequency
    * @param hashtable
    * @return
    */
-  public static int[] extractCdnaProfile(Hashtable hashtable,
+  public static int[] extractCdnaProfile(
+          Hashtable<String, Object> hashtable,
           boolean ignoreGaps)
   {
     // this holds #seqs, #ungapped, and then codon count, indexed by encoded
@@ -546,7 +547,7 @@ public class AAFrequency
    *          the consensus data stores to be populated (one per column)
    */
   public static void calculateCdna(AlignmentI alignment,
-          Hashtable[] hconsensus)
+          Hashtable<String, Object>[] hconsensus)
   {
     final char gapCharacter = alignment.getGapCharacter();
     List<AlignedCodonFrame> mappings = alignment.getCodonFrames();
@@ -559,7 +560,7 @@ public class AAFrequency
     for (int col = 0; col < cols; col++)
     {
       // todo would prefer a Java bean for consensus data
-      Hashtable<String, int[]> columnHash = new Hashtable<>();
+      Hashtable<String, Object> columnHash = new Hashtable<>();
       // #seqs, #ungapped seqs, counts indexed by (codon encoded + 1)
       int[] codonCounts = new int[66];
       codonCounts[0] = alignment.getSequences().size();
@@ -604,7 +605,8 @@ public class AAFrequency
    */
   public static void completeCdnaConsensus(
           AlignmentAnnotation consensusAnnotation,
-          Hashtable[] consensusData, boolean showProfileLogo, int nseqs)
+          Hashtable<String, Object>[] consensusData, boolean showProfileLogo,
+          int nseqs)
   {
     if (consensusAnnotation == null
             || consensusAnnotation.annotations == null
@@ -619,7 +621,7 @@ public class AAFrequency
     consensusAnnotation.scaleColLabel = true;
     for (int col = 0; col < consensusData.length; col++)
     {
-      Hashtable hci = consensusData[col];
+      Hashtable<String, Object> hci = consensusData[col];
       if (hci == null)
       {
         // gapped protein column?
index 546a214..cc97be0 100644 (file)
@@ -27,7 +27,6 @@ import jalview.datamodel.SequenceI;
 import jalview.util.Comparison;
 import jalview.util.Format;
 
-import java.util.ArrayList;
 import java.util.Hashtable;
 
 /**
@@ -94,11 +93,11 @@ public class StructureFrequency
    * @param rnaStruc
    */
   public static final void calculate(SequenceI[] sequences, int start,
-          int end, Hashtable[] result, boolean profile,
+          int end, Hashtable<String, Object>[] result, boolean profile,
           AlignmentAnnotation rnaStruc)
   {
 
-    Hashtable residueHash;
+    Hashtable<String, Object> residueHash;
     String maxResidue;
     char[] struc = rnaStruc.getRNAStruc().toCharArray();
 
@@ -191,7 +190,7 @@ public class StructureFrequency
         }
       }
 
-      residueHash = new Hashtable();
+      residueHash = new Hashtable<>();
       if (profile)
       {
         // TODO 1-dim array with jsize in [0], nongapped in [1]; or Pojo
@@ -251,7 +250,7 @@ public class StructureFrequency
         maxResidue = maxResidue.equals("(") ? ")"
                 : maxResidue.equals("[") ? "]" : "}";
 
-        residueHash = new Hashtable();
+        residueHash = new Hashtable<>();
         if (profile)
         {
           residueHash.put(PROFILE,
@@ -288,7 +287,7 @@ public class StructureFrequency
    * @param includeAllConsSymbols
    */
   public static void completeConsensus(AlignmentAnnotation consensus,
-          Hashtable[] hconsensus, int iStart, int width,
+          Hashtable<String, Object>[] hconsensus, int iStart, int width,
           boolean ignoreGapsInConsensusCalculation,
           boolean includeAllConsSymbols, long nseq)
   {
@@ -315,7 +314,7 @@ public class StructureFrequency
 
     for (int i = iStart; i < width; i++)
     {
-      Hashtable hci;
+      Hashtable<String, Object> hci;
       if (i >= hconsensus.length || ((hci = hconsensus[i]) == null))
       {
         // happens if sequences calculated over were shorter than alignment
@@ -415,7 +414,7 @@ public class StructureFrequency
    * @param hconsensus
    * @return profile of the given column
    */
-  public static int[] extractProfile(Hashtable hconsensus,
+  public static int[] extractProfile(Hashtable<String, Object> hconsensus,
           boolean ignoreGapsInConsensusCalculation)
   {
     int[] rtnval = new int[STRUCTURE_PROFILE_LENGTH]; // 2*(5*5)+2
index fd4f74d..dcd3258 100644 (file)
@@ -108,9 +108,9 @@ public interface AlignViewportI extends ViewStyleI
    * 
    * @return
    */
-  Hashtable[] getComplementConsensusHash();
+  Hashtable<String, Object>[] getComplementConsensusHash();
 
-  Hashtable[] getRnaStructureConsensusHash();
+  Hashtable<String, Object>[] getRnaStructureConsensusHash();
 
   boolean isIgnoreGapsConsensus();
 
@@ -178,7 +178,7 @@ public interface AlignViewportI extends ViewStyleI
    * 
    * @param hconsensus
    */
-  void setComplementConsensusHash(Hashtable[] hconsensus);
+  void setComplementConsensusHash(Hashtable<String, Object>[] hconsensus);
 
   /**
    * 
@@ -192,7 +192,8 @@ public interface AlignViewportI extends ViewStyleI
    * 
    * @param hStrucConsensus
    */
-  void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
+  void setRnaStructureConsensusHash(
+          Hashtable<String, Object>[] hStrucConsensus);
 
   /**
    * Sets the colour scheme for the background alignment (as distinct from
index 38cf3e6..95f85e6 100755 (executable)
@@ -646,7 +646,6 @@ public class FileLoader implements Runnable
    * @return
    * @throws FileNotFoundException 
    */
-  @SuppressWarnings("unused")
   public static BufferedReader getBufferedReader(Object file) throws FileNotFoundException {
     if (file instanceof String)
     {
index 29a0cc0..b703b47 100755 (executable)
@@ -31,6 +31,7 @@ import javax.swing.JScrollBar;
 import javax.swing.JScrollPane;
 import javax.swing.border.Border;
 
+@SuppressWarnings("serial")
 public class GAlignmentPanel extends JPanel
 {
          protected JScrollBar vscroll = new JScrollBar();
@@ -53,7 +54,7 @@ public class GAlignmentPanel extends JPanel
 
          BorderLayout borderLayout11 = new BorderLayout();
 
-         public JScrollPane annotationScroller = new JScrollPane();
+  public JScrollPane annotationScroller = new JScrollPane();
 
          Border border1;
 
index 548291c..c61606e 100644 (file)
@@ -80,9 +80,9 @@ public class AnnotationRenderer
 
   private ProfilesI hconsensus;
 
-  private Hashtable[] complementConsensus;
+  private Hashtable<String, Object>[] complementConsensus;
 
-  private Hashtable[] hStrucConsensus;
+  private Hashtable<String, Object>[] hStrucConsensus;
 
   private boolean av_ignoreGapsConsensus;
 
@@ -446,7 +446,7 @@ public class AnnotationRenderer
     updateFromAwtRenderPanel(annotPanel, av);
     fm = g.getFontMetrics();
     AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
-    int temp = 0;
+    // int temp = 0;
     if (aa == null)
     {
       return false;
@@ -459,8 +459,8 @@ public class AnnotationRenderer
     boolean validRes = false;
     boolean validEnd = false;
     boolean labelAllCols = false;
-    boolean centreColLabels;
-    boolean centreColLabelsDef = av.isCentreColumnLabels();
+//    boolean centreColLabels;
+//    boolean centreColLabelsDef = av.isCentreColumnLabels();
     boolean scaleColLabel = false;
     final AlignmentAnnotation consensusAnnot = av
             .getAlignmentConsensusAnnotation();
@@ -506,7 +506,7 @@ public class AnnotationRenderer
       {
         continue;
       }
-      centreColLabels = row.centreColLabels || centreColLabelsDef;
+//      centreColLabels = row.centreColLabels || centreColLabelsDef;
       labelAllCols = row.showAllColLabels;
       scaleColLabel = row.scaleColLabel;
       lastSS = ' ';
@@ -774,7 +774,7 @@ public class AnnotationRenderer
               if (x > -1)
               {
 
-                int nb_annot = x - temp;
+                // int nb_annot = x - temp;
                 // System.out.println("\t type :"+lastSS+"\t x :"+x+"\t nbre
                 // annot :"+nb_annot);
                 switch (lastSS)
@@ -783,7 +783,7 @@ public class AnnotationRenderer
                 case ')': // and opposite direction
                   drawStemAnnot(g, row_annotations, lastSSX, x, y,
                           iconOffset, startRes, column, validRes, validEnd);
-                  temp = x;
+                  // temp = x;
                   break;
 
                 case 'H':
@@ -866,13 +866,13 @@ public class AnnotationRenderer
                   drawNotCanonicalAnnot(g, nonCanColor, row_annotations,
                           lastSSX, x, y, iconOffset, startRes, column,
                           validRes, validEnd);
-                  temp = x;
+                  // temp = x;
                   break;
                 default:
                   g.setColor(Color.gray);
                   g.fillRect(lastSSX, y + 6 + iconOffset,
                           (x * charWidth) - lastSSX, 2);
-                  temp = x;
+                  // temp = x;
                   break;
                 }
               }
@@ -1113,7 +1113,7 @@ public class AnnotationRenderer
 
   public static final Color STEM_COLOUR = Color.blue;
 
-  private Color sdNOTCANONICAL_COLOUR;
+  // private Color sdNOTCANONICAL_COLOUR;
 
   void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX, int x,
           int y, int iconOffset, int startRes, int column, boolean validRes,
index e74f2e0..5a99c3d 100644 (file)
@@ -711,13 +711,13 @@ public abstract class AlignmentViewport
   /**
    * results of cDNA complement consensus visible portion of view
    */
-  protected Hashtable[] hcomplementConsensus = null;
+  protected Hashtable<String, Object>[] hcomplementConsensus = null;
 
   /**
    * results of secondary structure base pair consensus for visible portion of
    * view
    */
-  protected Hashtable[] hStrucConsensus = null;
+  protected Hashtable<String, Object>[] hStrucConsensus = null;
 
   protected Conservation hconservation = null;
 
@@ -746,7 +746,8 @@ public abstract class AlignmentViewport
   }
 
   @Override
-  public void setComplementConsensusHash(Hashtable[] hconsensus)
+  public void setComplementConsensusHash(
+          Hashtable<String, Object>[] hconsensus)
   {
     this.hcomplementConsensus = hconsensus;
   }
@@ -758,19 +759,20 @@ public abstract class AlignmentViewport
   }
 
   @Override
-  public Hashtable[] getComplementConsensusHash()
+  public Hashtable<String, Object>[] getComplementConsensusHash()
   {
     return hcomplementConsensus;
   }
 
   @Override
-  public Hashtable[] getRnaStructureConsensusHash()
+  public Hashtable<String, Object>[] getRnaStructureConsensusHash()
   {
     return hStrucConsensus;
   }
 
   @Override
-  public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
+  public void setRnaStructureConsensusHash(
+          Hashtable<String, Object>[] hStrucConsensus)
   {
     this.hStrucConsensus = hStrucConsensus;
 
@@ -1800,7 +1802,7 @@ public abstract class AlignmentViewport
       }
     } while (end < max);
 
-    int[][] startEnd = new int[regions.size()][2];
+    // int[][] startEnd = new int[regions.size()][2];
 
     return regions;
   }
@@ -2155,7 +2157,7 @@ public abstract class AlignmentViewport
      * TODO reorder the annotation rows according to group/sequence ordering on
      * alignment
      */
-    boolean sortg = true;
+    // boolean sortg = true;
 
     // remove old automatic annotation
     // add any new annotation
index 431fbec..aca8ed0 100644 (file)
@@ -25,7 +25,6 @@ import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceI;
 
 import java.util.ConcurrentModificationException;
 import java.util.Hashtable;
@@ -53,7 +52,7 @@ public class ComplementConsensusThread extends ConsensusThread
   }
 
   @Override
-  protected Hashtable[] getViewportConsensus()
+  protected Hashtable<String, Object>[] getViewportConsensus()
   {
     return alignViewport.getComplementConsensusHash();
   }
@@ -64,9 +63,11 @@ public class ComplementConsensusThread extends ConsensusThread
   @Override
   protected void computeConsensus(AlignmentI alignment)
   {
-    Hashtable[] hconsensus = new Hashtable[alignment.getWidth()];
+    @SuppressWarnings("unchecked")
+    Hashtable<String, Object>[] hconsensus = new Hashtable[alignment
+            .getWidth()];
 
-    SequenceI[] aseqs = getSequences();
+    // SequenceI[] aseqs = getSequences();
 
     /*
      * Allow 3 tries at this, since this thread can start up while we are still
@@ -97,7 +98,7 @@ public class ComplementConsensusThread extends ConsensusThread
    *          the computed consensus data
    */
   protected void deriveConsensus(AlignmentAnnotation consensusAnnotation,
-          Hashtable[] consensusData)
+          Hashtable<String, Object>[] consensusData)
   {
     AAFrequency.completeCdnaConsensus(consensusAnnotation, consensusData,
             alignViewport.isShowSequenceLogo(), getSequences().length);
@@ -107,7 +108,7 @@ public class ComplementConsensusThread extends ConsensusThread
   public void updateResultAnnotation(boolean immediate)
   {
     AlignmentAnnotation consensus = getConsensusAnnotation();
-    Hashtable[] hconsensus = getViewportConsensus();
+    Hashtable<String, Object>[] hconsensus = getViewportConsensus();
     if (immediate || !calcMan.isWorking(this) && consensus != null
             && hconsensus != null)
     {
index 78c6da2..1a5aaa4 100644 (file)
@@ -46,7 +46,7 @@ public class ConsensusThread extends AlignCalcWorker
       return;
     }
     calcMan.notifyStart(this);
-    long started = System.currentTimeMillis();
+    // long started = System.currentTimeMillis();
     try
     {
       AlignmentAnnotation consensus = getConsensusAnnotation();