in progress
[jalview.git] / forester / java / src / org / forester / phylogeny / data / NodeData.java
index d1c75e2..eb41d94 100644 (file)
@@ -7,7 +7,7 @@
 // Copyright (C) 2000-2001 Washington University School of Medicine
 // and Howard Hughes Medical Institute
 // All rights reserved
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
@@ -17,7 +17,7 @@
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 // Lesser General Public License for more details.
-// 
+//
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@@ -38,17 +38,18 @@ import org.forester.util.ForesterUtil;
 
 public class NodeData implements PhylogenyData {
 
-    private String             _node_name;
-    private Event              _event;
-    private List<Sequence>     _sequences;
-    private Identifier         _node_identifier;
-    private List<Taxonomy>     _taxonomies;
-    private List<Distribution> _distributions;
-    private Date               _date;
-    private BinaryCharacters   _binary_characters;
-    private PropertiesMap      _properties;
-    private List<Reference>    _references;
-    private List<Double>       _vector;
+    private String                  _node_name;
+    private Event                   _event;
+    private List<Sequence>          _sequences;
+    private Identifier              _node_identifier;
+    private List<Taxonomy>          _taxonomies;
+    private List<Distribution>      _distributions;
+    private Date                    _date;
+    private BinaryCharacters        _binary_characters;
+    private PropertiesMap           _properties;
+    private List<Reference>         _references;
+    private List<Double>            _vector;
+    private List<NodeVisualization> _node_visualizations;
 
     public NodeData() {
         init();
@@ -86,14 +87,17 @@ public class NodeData implements PhylogenyData {
         _taxonomies.add( taxonomy );
     }
 
+    @Override
     public StringBuffer asSimpleText() {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public StringBuffer asText() {
         throw new UnsupportedOperationException();
     }
 
+    @Override
     public PhylogenyData copy() {
         final NodeData new_data = new NodeData();
         new_data.setNodeName( getNodeName() );
@@ -138,6 +142,14 @@ public class NodeData implements PhylogenyData {
                 }
             }
         }
+        if ( ( getNodeVisualizations() != null ) && ( getNodeVisualizations().size() > 0 ) ) {
+            new_data.setNodeVisualizations( new ArrayList<NodeVisualization>() );
+            for( final NodeVisualization v : getNodeVisualizations() ) {
+                if ( v != null ) {
+                    new_data.getNodeVisualizations().add( ( NodeVisualization ) v.copy() );
+                }
+            }
+        }
         if ( isHasDate() ) {
             new_data.setDate( ( Date ) getDate().copy() );
         }
@@ -237,6 +249,7 @@ public class NodeData implements PhylogenyData {
         return _taxonomies.get( index );
     }
 
+    @Override
     public boolean isEqual( final PhylogenyData data ) {
         throw new UnsupportedOperationException();
     }
@@ -268,7 +281,7 @@ public class NodeData implements PhylogenyData {
     }
 
     public boolean isHasProperties() {
-        return getProperties() != null;
+        return ( getProperties() != null ) && ( getProperties().size() > 0 );
     }
 
     public boolean isHasReference() {
@@ -413,6 +426,7 @@ public class NodeData implements PhylogenyData {
         }
     }
 
+    @Override
     public StringBuffer toNHX() {
         final StringBuffer sb = new StringBuffer();
         if ( isHasNodeIdentifier() ) {
@@ -433,6 +447,7 @@ public class NodeData implements PhylogenyData {
         return sb;
     }
 
+    @Override
     public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException {
         if ( isHasNodeIdentifier() ) {
             writer.write( ForesterUtil.LINE_SEPARATOR );
@@ -521,4 +536,12 @@ public class NodeData implements PhylogenyData {
     public void setNodeName( final String node_name ) {
         _node_name = node_name;
     }
+
+    public void setNodeVisualizations( final List<NodeVisualization> _node_visualizations ) {
+        this._node_visualizations = _node_visualizations;
+    }
+
+    public List<NodeVisualization> getNodeVisualizations() {
+        return _node_visualizations;
+    }
 }