From d668b0fe1a9eefb95c935bc6c71a88e67642e712 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 7 Jun 2012 11:03:14 +0100 Subject: [PATCH] javatidy --- src/jalview/api/AlignCalcManagerI.java | 16 ++++++------ src/jalview/appletgui/OverviewPanel.java | 29 ++++++++++++++------- src/jalview/renderer/AnnotationRenderer.java | 22 ++++++++-------- src/jalview/workers/ConservationThread.java | 31 +++++++++++----------- src/jalview/workers/StrucConsensusThread.java | 34 +++++++++++++++---------- 5 files changed, 76 insertions(+), 56 deletions(-) diff --git a/src/jalview/api/AlignCalcManagerI.java b/src/jalview/api/AlignCalcManagerI.java index e9b625b..a7b17c6 100644 --- a/src/jalview/api/AlignCalcManagerI.java +++ b/src/jalview/api/AlignCalcManagerI.java @@ -7,7 +7,7 @@ import jalview.datamodel.AlignmentAnnotation; public interface AlignCalcManagerI { - + /** * tell manager that a worker is initialised and has started to run * @param worker @@ -41,7 +41,7 @@ public interface AlignCalcManagerI void workerCannotRun(AlignCalcWorkerI worker); /** - * indicate that a worker like this may be run on the platform. + * indicate that a worker like this may be run on the platform. * @param worker of class to be removed from the execution blacklist */ void workerMayRun(AlignCalcWorkerI worker); @@ -52,7 +52,7 @@ public interface AlignCalcManagerI void startWorker(AlignCalcWorkerI worker); /** - * + * * @param worker * @return */ @@ -64,7 +64,7 @@ public interface AlignCalcManagerI */ boolean isWorking(); - + /** * register a restartable worker * @param worker @@ -72,25 +72,25 @@ public interface AlignCalcManagerI void registerWorker(AlignCalcWorkerI worker); /** - * restart any registered workers + * restart any registered workers */ void restartWorkers(); /** - * + * * @param alignmentAnnotation * @return true if a currently registered and working worker indicates its involvement with the given alignmentAnnotation */ boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation); /** - * kick any known instances of the given worker class to update their annotation + * kick any known instances of the given worker class to update their annotation * @param workerClass */ void updateAnnotationFor(Class workerClass); /** - * return any registered workers of the given class + * return any registered workers of the given class * @param workerClass * @return null or one or more workers of the given class */ diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index ba066a1..b48b2a4 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -1,18 +1,18 @@ /* * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle - * + * * 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 + * 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 + * + * 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 . */ package jalview.appletgui; @@ -67,7 +67,7 @@ public class OverviewPanel extends Panel implements Runnable, sr.forOverview = true; fr = new FeatureRenderer(av); fr.overview = true; - + // scale the initial size of overviewpanel to shape of alignment float initialScale = (float) av.getAlignment().getWidth() / (float) av.getAlignment().getHeight(); @@ -102,6 +102,7 @@ public class OverviewPanel extends Panel implements Runnable, addComponentListener(new ComponentAdapter() { + @Override public void componentResized(ComponentEvent evt) { if (getSize().width != width @@ -120,22 +121,27 @@ public class OverviewPanel extends Panel implements Runnable, } + @Override public void mouseEntered(MouseEvent evt) { } + @Override public void mouseExited(MouseEvent evt) { } + @Override public void mouseClicked(MouseEvent evt) { } + @Override public void mouseMoved(MouseEvent evt) { } + @Override public void mousePressed(MouseEvent evt) { boxX = evt.getX(); @@ -143,6 +149,7 @@ public class OverviewPanel extends Panel implements Runnable, checkValid(); } + @Override public void mouseReleased(MouseEvent evt) { boxX = evt.getX(); @@ -150,6 +157,7 @@ public class OverviewPanel extends Panel implements Runnable, checkValid(); } + @Override public void mouseDragged(MouseEvent evt) { boxX = evt.getX(); @@ -242,6 +250,7 @@ public class OverviewPanel extends Panel implements Runnable, // the overview is being calculated boolean resizeAgain = false; + @Override public void run() { miniMe = null; @@ -435,11 +444,13 @@ public class OverviewPanel extends Panel implements Runnable, repaint(); } + @Override public void update(Graphics g) { paint(g); } + @Override public void paint(Graphics g) { Graphics og = offscreen.getGraphics(); diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index cfdfdf6..96b433d 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -91,7 +91,7 @@ public class AnnotationRenderer private FontMetrics fm; - private boolean MAC = new jalview.util.Platform().isAMac(); + private final boolean MAC = new jalview.util.Platform().isAMac(); boolean av_renderHistogram = true, av_renderProfile = true, av_normaliseProfile = false; @@ -213,7 +213,7 @@ public class AnnotationRenderer /** * DOCUMENT ME! - * + * * @param annotationPanel * TODO * @param g @@ -304,22 +304,22 @@ public class AnnotationRenderer /* * else if (annotationPanel.av.updatingConservation && * aa[i].label.equals("Conservation")) { - * + * * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y - * row.height, annotationPanel.imgWidth, y, 0, y - row.height, * annotationPanel.imgWidth, y, annotationPanel); - * + * * g.setColor(Color.black); // * g.drawString("Calculating Conservation.....",20, y-row.height/2); - * + * * continue; } else if (annotationPanel.av.updatingConservation && * aa[i].label.equals("Quality")) { - * + * * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y - * row.height, annotationPanel.imgWidth, y, 0, y - row.height, * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black); * // / g.drawString("Calculating Quality....",20, y-row.height/2); - * + * * continue; } */ // first pass sets up state for drawing continuation from left-hand column @@ -602,13 +602,13 @@ public class AnnotationRenderer } } - private Color GLYPHLINE_COLOR = Color.gray; + private final Color GLYPHLINE_COLOR = Color.gray; - private Color SHEET_COLOUR = Color.green; + private final Color SHEET_COLOUR = Color.green; - private Color HELIX_COLOUR = Color.red; + private final Color HELIX_COLOUR = Color.red; - private Color STEM_COLOUR = Color.blue; + private final Color STEM_COLOUR = Color.blue; public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX, int x, int y, int iconOffset, int startRes, diff --git a/src/jalview/workers/ConservationThread.java b/src/jalview/workers/ConservationThread.java index 7d5c661..47ce6eb 100644 --- a/src/jalview/workers/ConservationThread.java +++ b/src/jalview/workers/ConservationThread.java @@ -1,18 +1,18 @@ /* * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle - * + * * 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 + * 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 + * + * 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 . */ package jalview.workers; @@ -31,23 +31,24 @@ public class ConservationThread extends AlignCalcWorker implements AlignCalcWork { private int ConsPercGaps = 25; // JBPNote : This should be a configurable property! - + public ConservationThread(AlignViewportI alignViewport, AlignmentViewPanel alignPanel) { super(alignViewport, alignPanel); ConsPercGaps = alignViewport.getConsPercGaps(); } - + private Conservation cons; AlignmentAnnotation conservation,quality; int alWidth; + @Override public void run() { try { calcMan.notifyStart(this); // updatingConservation = true; - while (!calcMan.notifyWorking(this)) + while (!calcMan.notifyWorking(this)) { try { @@ -71,15 +72,15 @@ public class ConservationThread extends AlignCalcWorker implements AlignCalcWork ourAnnot.add(conservation); ourAnnot.add(quality); ourAnnots = ourAnnot; - + // AlignViewport.UPDATING_CONSERVATION = true; - + if (alignment==null || (alWidth=alignment.getWidth())< 0) { calcMan.workerComplete(this); //.updatingConservation = false; //AlignViewport.UPDATING_CONSERVATION = false; - + return; } @@ -114,6 +115,6 @@ public class ConservationThread extends AlignCalcWorker implements AlignCalcWork public void updateAnnotation() { updateResultAnnotation(false); - + } } diff --git a/src/jalview/workers/StrucConsensusThread.java b/src/jalview/workers/StrucConsensusThread.java index 69236d8..ea900dc 100644 --- a/src/jalview/workers/StrucConsensusThread.java +++ b/src/jalview/workers/StrucConsensusThread.java @@ -11,16 +11,20 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; -public class StrucConsensusThread extends AlignCalcWorker implements AlignCalcWorkerI +public class StrucConsensusThread extends AlignCalcWorker implements + AlignCalcWorkerI { public StrucConsensusThread(AlignViewportI alignViewport, AlignmentViewPanel alignPanel) { super(alignViewport, alignPanel); } + AlignmentAnnotation strucConsensus; + Hashtable[] hStrucConsensus; + @Override public void run() { try @@ -54,8 +58,8 @@ public class StrucConsensusThread extends AlignCalcWorker implements AlignCalcWo calcMan.workerComplete(this); return; } - strucConsensus=alignViewport.getAlignmentStrucConsensusAnnotation(); - hStrucConsensus=alignViewport.getRnaStructureConsensusHash(); + strucConsensus = alignViewport.getAlignmentStrucConsensusAnnotation(); + hStrucConsensus = alignViewport.getRnaStructureConsensusHash(); strucConsensus.annotations = null; strucConsensus.annotations = new Annotation[aWidth]; @@ -74,19 +78,20 @@ public class StrucConsensusThread extends AlignCalcWorker implements AlignCalcWo } } // check to see if its valid - - if (rnaStruc==null || !rnaStruc.isValidStruc()) + + if (rnaStruc == null || !rnaStruc.isValidStruc()) { calcMan.workerComplete(this); return; } - - jalview.analysis.StructureFrequency.calculate(alignment.getSequencesArray(), 0, - alignment.getWidth(), hStrucConsensus, true, rnaStruc); + + jalview.analysis.StructureFrequency.calculate( + alignment.getSequencesArray(), 0, alignment.getWidth(), + hStrucConsensus, true, rnaStruc); alignViewport.setRnaStructureConsensusHash(hStrucConsensus); // TODO AlignmentAnnotation rnaStruc!!! updateResultAnnotation(true); - if (alignViewport.getGlobalColourScheme()!= null) + if (alignViewport.getGlobalColourScheme() != null) { alignViewport.getGlobalColourScheme().setConsensus(hStrucConsensus); } @@ -107,10 +112,12 @@ public class StrucConsensusThread extends AlignCalcWorker implements AlignCalcWo } } + /** * update the consensus annotation from the sequence profile data using * current visualization settings. */ + @Override public void updateAnnotation() { updateResultAnnotation(false); @@ -118,12 +125,13 @@ public class StrucConsensusThread extends AlignCalcWorker implements AlignCalcWo public void updateResultAnnotation(boolean immediate) { - if (immediate || !calcMan.isWorking(this) && strucConsensus!=null && hStrucConsensus!=null) + if (immediate || !calcMan.isWorking(this) && strucConsensus != null + && hStrucConsensus != null) { - StructureFrequency.completeConsensus(strucConsensus, - hStrucConsensus, 0, hStrucConsensus.length, + StructureFrequency.completeConsensus(strucConsensus, hStrucConsensus, + 0, hStrucConsensus.length, alignViewport.getIgnoreGapsConsensus(), - alignViewport.isShowSequenceLogo()); + alignViewport.isShowSequenceLogo()); } } -- 1.7.10.2