inprogress
[jalview.git] / forester / java / src / org / forester / io / writers / PhylogenyWriter.java
index 8ee4522..e4b7dc7 100644 (file)
@@ -21,7 +21,7 @@
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 //
 // Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
 
 package org.forester.io.writers;
 
@@ -41,7 +41,7 @@ import org.forester.io.parsers.nexus.NexusConstants;
 import org.forester.io.parsers.phyloxml.PhyloXmlMapping;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyNode;
-import org.forester.phylogeny.PhylogenyNodeI.NH_CONVERSION_SUPPORT_VALUE_STYLE;
+import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE;
 import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
 import org.forester.phylogeny.iterators.PostOrderStackObject;
@@ -481,10 +481,8 @@ public final class PhylogenyWriter {
         writer.flush();
         writer.close();
     }
-    
-    public void toPhyloXML( final Phylogeny phy,
-                            final int phyloxml_level,
-                            final File out_file ) throws IOException {
+
+    public void toPhyloXML( final Phylogeny phy, final int phyloxml_level, final File out_file ) throws IOException {
         final Writer writer = new BufferedWriter( new PrintWriter( out_file ) );
         toPhyloXML( writer, phy, phyloxml_level );
         writer.flush();
@@ -624,44 +622,24 @@ public final class PhylogenyWriter {
         }
         if ( tree != null ) {
             reset( writer, tree );
-            boolean rerootable = true;
             String unit = "";
             String type = "";
-            String rooted = "false";
-            if ( tree.isRooted() ) {
-                rooted = "true";
-            }
-            if ( !tree.isRerootable() ) {
-                rerootable = false;
-            }
             if ( !ForesterUtil.isEmpty( tree.getDistanceUnit() ) ) {
                 unit = tree.getDistanceUnit();
             }
             if ( !ForesterUtil.isEmpty( tree.getType() ) ) {
                 type = tree.getType();
             }
-            if ( rerootable ) {
-                PhylogenyDataUtil.appendOpen( writer,
-                                              PhyloXmlMapping.PHYLOGENY,
-                                              PhyloXmlMapping.PHYLOGENY_IS_ROOTED_ATTR,
-                                              rooted,
-                                              PhyloXmlMapping.PHYLOGENY_BRANCHLENGTH_UNIT_ATTR,
-                                              unit,
-                                              PhyloXmlMapping.PHYLOGENY_TYPE_ATTR,
-                                              type );
-            }
-            else {
-                PhylogenyDataUtil.appendOpen( writer,
-                                              PhyloXmlMapping.PHYLOGENY,
-                                              PhyloXmlMapping.PHYLOGENY_IS_ROOTED_ATTR,
-                                              rooted,
-                                              PhyloXmlMapping.PHYLOGENY_BRANCHLENGTH_UNIT_ATTR,
-                                              unit,
-                                              PhyloXmlMapping.PHYLOGENY_TYPE_ATTR,
-                                              type,
-                                              PhyloXmlMapping.PHYLOGENY_IS_REROOTABLE_ATTR,
-                                              "false" );
-            }
+            PhylogenyDataUtil.appendOpen( writer,
+                                          PhyloXmlMapping.PHYLOGENY,
+                                          PhyloXmlMapping.PHYLOGENY_IS_ROOTED_ATTR,
+                                          tree.isRooted() + "",
+                                          PhyloXmlMapping.PHYLOGENY_BRANCHLENGTH_UNIT_ATTR,
+                                          unit,
+                                          PhyloXmlMapping.PHYLOGENY_TYPE_ATTR,
+                                          type,
+                                          PhyloXmlMapping.PHYLOGENY_IS_REROOTABLE_ATTR,
+                                          tree.isRerootable() + "" );
             appendPhylogenyLevelPhyloXml( writer, tree );
             while ( isHasNext() ) {
                 next();