+ private void collapseBl( final Phylogeny phy ) {\r
+ final PhylogenyNodeIterator it = phy.iteratorPostorder();\r
+ final List<PhylogenyNode> to_be_removed = new ArrayList<PhylogenyNode>();\r
+ double min_bl = Double.MAX_VALUE;\r
+ boolean bl_present = false;\r
+ while ( it.hasNext() ) {\r
+ final PhylogenyNode n = it.next();\r
+ if ( !n.isExternal() && !n.isRoot() ) {\r
+ final double bl = n.getDistanceToParent();\r
+ if ( bl != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {\r
+ bl_present = true;\r
+ if ( bl < getMinNotCollapseBlValue() ) {\r
+ to_be_removed.add( n );\r
+ }\r
+ if ( bl < min_bl ) {\r
+ min_bl = bl;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ if ( bl_present ) {\r
+ for( final PhylogenyNode node : to_be_removed ) {\r
+ PhylogenyMethods.removeNode( node, phy );\r
+ }\r
+ if ( to_be_removed.size() > 0 ) {\r
+ phy.externalNodesHaveChanged();\r
+ phy.clearHashIdToNodeMap();\r
+ phy.recalculateNumberOfExternalDescendants( true );\r
+ getCurrentTreePanel().resetNodeIdToDistToLeafMap();\r
+ getCurrentTreePanel().updateSetOfCollapsedExternalNodes();\r
+ getCurrentTreePanel().calculateLongestExtNodeInfo();\r
+ getCurrentTreePanel().setNodeInPreorderToNull();\r
+ getCurrentTreePanel().recalculateMaxDistanceToRoot();\r
+ getCurrentTreePanel().resetPreferredSize();\r
+ getCurrentTreePanel().setEdited( true );\r
+ getCurrentTreePanel().repaint();\r
+ repaint();\r
+ }\r
+ if ( to_be_removed.size() > 0 ) {\r
+ JOptionPane.showMessageDialog( this, "Collapsed " + to_be_removed.size()\r
+ + " branches with\nbranch length values below " + getMinNotCollapseBlValue(), "Collapsed "\r
+ + to_be_removed.size() + " branches", JOptionPane.INFORMATION_MESSAGE );\r
+ }\r
+ else {\r
+ JOptionPane.showMessageDialog( this,\r
+ "No branch collapsed,\nminimum branch length is " + min_bl,\r
+ "No branch collapsed",\r
+ JOptionPane.INFORMATION_MESSAGE );\r
+ }\r
+ }\r
+ else {\r
+ JOptionPane.showMessageDialog( this,\r
+ "No branch collapsed because no branch length values present",\r
+ "No branch length values present",\r
+ JOptionPane.INFORMATION_MESSAGE );\r
+ }\r
+ }\r
+\r
+ private void collapse( final Phylogeny phy ) {\r