From: kjvdheide Date: Fri, 10 Nov 2017 13:42:50 +0000 (+0000) Subject: JAL-2794 most method parameters/class variables made final X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=88b0efc5c269e97f1a4725a62599c6725e97416d;p=jalview.git JAL-2794 most method parameters/class variables made final --- diff --git a/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java b/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java index aaf7ffb..86f0020 100644 --- a/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java +++ b/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java @@ -22,21 +22,21 @@ public final class ArchaeopteryxInit * @param aptxTrees * @return */ - public static MainFrame createUnboundInstance(Phylogeny aptxTree) + public static MainFrame createUnboundInstance(final Phylogeny aptxTree) { Phylogeny[] aptxTrees = { aptxTree }; return createBoundAptxFrame(aptxTrees, null); } - public static MainFrame createInstance(Phylogeny[] aptxTrees, + public static MainFrame createInstance(final Phylogeny[] aptxTrees, AlignmentViewport jalviewAlignmentView) { return createBoundAptxFrame(aptxTrees, jalviewAlignmentView); } - public static MainFrame createInstance(Phylogeny aptxTree, - AlignmentViewport jalviewAlignmentView) + public static MainFrame createInstance(final Phylogeny aptxTree, + final AlignmentViewport jalviewAlignmentView) { Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in // several trees simultaneously @@ -45,7 +45,7 @@ public final class ArchaeopteryxInit } public static MainFrame createInstance( - TreeBuilder calculatedTree) // very dense method, to be split up + final TreeBuilder calculatedTree) // very dense method, to be split up { ArchaeopteryxTreeConverter aptxTreeBuilder = new ArchaeopteryxTreeConverter( calculatedTree); @@ -66,8 +66,8 @@ public final class ArchaeopteryxInit - private static MainFrame createBoundAptxFrame(Phylogeny[] aptxTrees, - AlignmentViewport jalviewAlignmentView) + private static MainFrame createBoundAptxFrame(final Phylogeny[] aptxTrees, + final AlignmentViewport jalviewAlignmentView) { MainFrame aptxApp = Archaeopteryx.createApplication(aptxTrees, "_aptx_jalview_configuration_file", null); @@ -75,17 +75,17 @@ public final class ArchaeopteryxInit return aptxApp; } - private static void bindNodesToJalviewSequences(MainFrame aptxApp, - AlignmentViewport jalviewAlignViewport, - Map alignMappedToNodes, - Map nodesMappedToAlign) + private static void bindNodesToJalviewSequences(final MainFrame aptxApp, + final AlignmentViewport jalviewAlignViewport, + final Map alignMappedToNodes, + final Map nodesMappedToAlign) { new JalviewAptxBinding(aptxApp, jalviewAlignViewport, alignMappedToNodes, nodesMappedToAlign); } - private static MainFrame bindFrameToJalview(MainFrame aptxApp) + private static MainFrame bindFrameToJalview(final MainFrame aptxApp) { int width = 400; int height = 550; diff --git a/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java b/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java index 640c3ec..0bdd4e2 100644 --- a/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java +++ b/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java @@ -15,7 +15,14 @@ import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.data.NodeData; import org.forester.phylogeny.data.Sequence; -public class ArchaeopteryxTreeConverter // implements PhylogenyFactory +/** + * Note that this currently demands a 1:1 relationship between nodes and + * sequences + * + * @author kjvanderheide + * + */ +public class ArchaeopteryxTreeConverter { protected final SequenceI[] sequences; @@ -68,7 +75,7 @@ public class ArchaeopteryxTreeConverter // implements PhylogenyFactory for (SequenceI sequence : sequences) { Sequence seq = ForesterConversions - .createForesterSequence(sequence); + .createForesterSequence(sequence, true); PhylogenyNode sequenceNode = new PhylogenyNode(sequence.getName()); NodeData nodeData = sequenceNode.getNodeData(); nodeData.setSequence(seq); diff --git a/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java b/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java index 755828d..9466924 100644 --- a/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewAptxBinding.java @@ -24,16 +24,16 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI AlignmentViewport parentAvport; - StructureSelectionManager ssm; + final StructureSelectionManager ssm; Map sequencesBoundToNodes; Map nodesBoundToSequences; - public JalviewAptxBinding(MainFrame archaeopteryx, - AlignmentViewport jalviewAlignmentViewport, - Map alignMappedToNodes, - Map nodesMappedToAlign) + public JalviewAptxBinding(final MainFrame archaeopteryx, + final AlignmentViewport jalviewAlignmentViewport, + final Map alignMappedToNodes, + final Map nodesMappedToAlign) { parentAvport = jalviewAlignmentViewport; sequencesBoundToNodes = alignMappedToNodes; @@ -56,7 +56,7 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI } @Override - public void mousePressed(MouseEvent e) + public void mousePressed(final MouseEvent e) { showNodeSelectionOnAlign(e); } @@ -76,12 +76,14 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI { } + @Override - public void selection(SequenceGroup seqsel, ColumnSelection colsel, - HiddenColumns hidden, SelectionSource source) + public void selection(final SequenceGroup seqsel, + final ColumnSelection colsel, final HiddenColumns hidden, + final SelectionSource source) { if (source == parentAvport) // check if source is alignment from where the - // tree originates + // tree originates { treeView.setFoundNodes0( new HashSet(seqsel.getSequences().size())); @@ -103,10 +105,11 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI } /** - * Note that this currently only checks external nodes + * If a node is selected in the tree panel this method highlights the + * corresponding sequence in the Jalview alignment view. */ @Override - public void showNodeSelectionOnAlign(MouseEvent e) + public void showNodeSelectionOnAlign(final MouseEvent e) { final PhylogenyNode node = treeView.findNode(e.getX(), e.getY()); if (node != null) @@ -131,11 +134,13 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI treeSelectionChanged(matchingSequence); parentAvport.sendSelection(); // not actually needed? - PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); + + } } + } /** @@ -143,7 +148,7 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI * * @param sequence */ - public void treeSelectionChanged(SequenceI sequence) + public void treeSelectionChanged(final SequenceI sequence) { SequenceGroup selected = parentAvport.getSelectionGroup(); @@ -163,7 +168,7 @@ public class JalviewAptxBinding implements JalviewTreeViewerBindingI return parentAvport; } - public void setParentAvport(AlignmentViewport parentAvport) + public void setParentAvport(final AlignmentViewport parentAvport) { this.parentAvport = parentAvport; } diff --git a/src/jalview/ext/forester/ForesterConversions.java b/src/jalview/ext/forester/ForesterConversions.java index e35132c..5a66974 100644 --- a/src/jalview/ext/forester/ForesterConversions.java +++ b/src/jalview/ext/forester/ForesterConversions.java @@ -9,14 +9,17 @@ import org.forester.io.parsers.phyloxml.PhyloXmlDataFormatException; public final class ForesterConversions { public static org.forester.phylogeny.data.Sequence createForesterSequence( - SequenceI jalviewSequence) + final SequenceI jalviewSequence, final boolean sequenceIsAligned) { org.forester.phylogeny.data.Sequence foresterSeq = new org.forester.phylogeny.data.Sequence(); + if (jalviewSequence.getDescription() != null) { foresterSeq.setName(jalviewSequence.getDescription()); } - foresterSeq.setMolecularSequenceAligned(true); // all tree sequences should + foresterSeq.setMolecularSequenceAligned(sequenceIsAligned); // all tree + // sequences + // should // be aligned already foresterSeq.setMolecularSequence(jalviewSequence.getSequenceAsString()); if (jalviewSequence.isProtein()) // add checks for DNA or RNA (infer from