in progress
[jalview.git] / forester / java / src / org / forester / phylogeny / data / NodeData.java
index c5c5d40..ab6f055 100644 (file)
@@ -52,17 +52,17 @@ public class NodeData implements PhylogenyData {
         TAXONOMY_CODE,
         UNKNOWN;
     }
-    private String                  _node_name;
-    private Event                   _event;
-    private List<Sequence>          _sequences;
-    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;
+    private String             _node_name;
+    private Event              _event;
+    private List<Sequence>     _sequences;
+    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 NodeVisualData     _node_visual_data;
 
     public NodeData() {
         init();
@@ -70,6 +70,16 @@ public class NodeData implements PhylogenyData {
 
     private void init() {
         _node_name = "";
+        _event = null;
+        _sequences = null;
+        _taxonomies = null;
+        _distributions = null;
+        _date = null;
+        _binary_characters = null;
+        _properties = null;
+        _references = null;
+        _vector = null;
+        _node_visual_data = null;
     }
 
     public void addDistribution( final Distribution distribution ) {
@@ -152,13 +162,8 @@ 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 ( ( getNodeVisualData() != null ) && !getNodeVisualData().isEmpty() ) {
+            new_data.setNodeVisualData( ( NodeVisualData ) getNodeVisualData().copy() );
         }
         if ( isHasDate() ) {
             new_data.setDate( ( Date ) getDate().copy() );
@@ -274,7 +279,7 @@ public class NodeData implements PhylogenyData {
         return ( getDate() != null )
                 && ( !ForesterUtil.isEmpty( getDate().getDesc() ) || !ForesterUtil.isNull( getDate().getMax() )
                         || !ForesterUtil.isNull( getDate().getMin() ) || !ForesterUtil.isNull( getDate().getValue() ) || !ForesterUtil
-                        .isEmpty( getDate().getUnit() ) );
+                            .isEmpty( getDate().getUnit() ) );
     }
 
     public boolean isHasDistribution() {
@@ -483,6 +488,9 @@ public class NodeData implements PhylogenyData {
         if ( isHasProperties() ) {
             getProperties().toPhyloXML( writer, level, indentation.substring( 0, indentation.length() - 2 ) );
         }
+        if ( ( level == 0 ) && ( getNodeVisualData() != null ) && !getNodeVisualData().isEmpty() ) {
+            getNodeVisualData().toPhyloXML( writer, level, indentation.substring( 0, indentation.length() - 2 ) );
+        }
         if ( ( getVector() != null )
                 && !getVector().isEmpty()
                 && ( ( getProperties() == null ) || getProperties()
@@ -523,11 +531,11 @@ public class NodeData implements PhylogenyData {
         _node_name = node_name;
     }
 
-    public void setNodeVisualizations( final List<NodeVisualization> _node_visualizations ) {
-        this._node_visualizations = _node_visualizations;
+    public void setNodeVisualData( final NodeVisualData node_visual_data ) {
+        _node_visual_data = node_visual_data;
     }
 
-    public List<NodeVisualization> getNodeVisualizations() {
-        return _node_visualizations;
+    public NodeVisualData getNodeVisualData() {
+        return _node_visual_data;
     }
 }