From: hansonr Date: Thu, 18 Apr 2019 03:54:33 +0000 (-0500) Subject: explicit Hashtable objects X-Git-Tag: Release_2_11_4_0~45^2~18^2~149 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=042832306c7e7aa0484079f3bab1e141b2944de5;p=jalview.git explicit Hashtable objects --- diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index a1b0325..61f3b7f 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -482,7 +482,8 @@ public class AAFrequency * @param hashtable * @return */ - public static int[] extractCdnaProfile(Hashtable hashtable, + public static int[] extractCdnaProfile( + Hashtable 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[] hconsensus) { final char gapCharacter = alignment.getGapCharacter(); List 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 columnHash = new Hashtable<>(); + Hashtable 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[] 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 hci = consensusData[col]; if (hci == null) { // gapped protein column? diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 546a214..cc97be0 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -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[] result, boolean profile, AlignmentAnnotation rnaStruc) { - Hashtable residueHash; + Hashtable 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[] 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 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 hconsensus, boolean ignoreGapsInConsensusCalculation) { int[] rtnval = new int[STRUCTURE_PROFILE_LENGTH]; // 2*(5*5)+2 diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index fd4f74d..dcd3258 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -108,9 +108,9 @@ public interface AlignViewportI extends ViewStyleI * * @return */ - Hashtable[] getComplementConsensusHash(); + Hashtable[] getComplementConsensusHash(); - Hashtable[] getRnaStructureConsensusHash(); + Hashtable[] getRnaStructureConsensusHash(); boolean isIgnoreGapsConsensus(); @@ -178,7 +178,7 @@ public interface AlignViewportI extends ViewStyleI * * @param hconsensus */ - void setComplementConsensusHash(Hashtable[] hconsensus); + void setComplementConsensusHash(Hashtable[] hconsensus); /** * @@ -192,7 +192,8 @@ public interface AlignViewportI extends ViewStyleI * * @param hStrucConsensus */ - void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus); + void setRnaStructureConsensusHash( + Hashtable[] hStrucConsensus); /** * Sets the colour scheme for the background alignment (as distinct from diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 38cf3e6..95f85e6 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -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) { diff --git a/src/jalview/jbgui/GAlignmentPanel.java b/src/jalview/jbgui/GAlignmentPanel.java index 29a0cc0..b703b47 100755 --- a/src/jalview/jbgui/GAlignmentPanel.java +++ b/src/jalview/jbgui/GAlignmentPanel.java @@ -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; diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 548291c..c61606e 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -80,9 +80,9 @@ public class AnnotationRenderer private ProfilesI hconsensus; - private Hashtable[] complementConsensus; + private Hashtable[] complementConsensus; - private Hashtable[] hStrucConsensus; + private Hashtable[] 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, diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index e74f2e0..5a99c3d 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -711,13 +711,13 @@ public abstract class AlignmentViewport /** * results of cDNA complement consensus visible portion of view */ - protected Hashtable[] hcomplementConsensus = null; + protected Hashtable[] hcomplementConsensus = null; /** * results of secondary structure base pair consensus for visible portion of * view */ - protected Hashtable[] hStrucConsensus = null; + protected Hashtable[] hStrucConsensus = null; protected Conservation hconservation = null; @@ -746,7 +746,8 @@ public abstract class AlignmentViewport } @Override - public void setComplementConsensusHash(Hashtable[] hconsensus) + public void setComplementConsensusHash( + Hashtable[] hconsensus) { this.hcomplementConsensus = hconsensus; } @@ -758,19 +759,20 @@ public abstract class AlignmentViewport } @Override - public Hashtable[] getComplementConsensusHash() + public Hashtable[] getComplementConsensusHash() { return hcomplementConsensus; } @Override - public Hashtable[] getRnaStructureConsensusHash() + public Hashtable[] getRnaStructureConsensusHash() { return hStrucConsensus; } @Override - public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus) + public void setRnaStructureConsensusHash( + Hashtable[] 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 diff --git a/src/jalview/workers/ComplementConsensusThread.java b/src/jalview/workers/ComplementConsensusThread.java index 431fbec..aca8ed0 100644 --- a/src/jalview/workers/ComplementConsensusThread.java +++ b/src/jalview/workers/ComplementConsensusThread.java @@ -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[] 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[] 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[] 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[] hconsensus = getViewportConsensus(); if (immediate || !calcMan.isWorking(this) && consensus != null && hconsensus != null) { diff --git a/src/jalview/workers/ConsensusThread.java b/src/jalview/workers/ConsensusThread.java index 78c6da2..1a5aaa4 100644 --- a/src/jalview/workers/ConsensusThread.java +++ b/src/jalview/workers/ConsensusThread.java @@ -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();