regex search
[jalview.git] / forester / java / src / org / forester / phylogeny / data / Distribution.java
index 9a6ebdb..0616f94 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
 // 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
 //
 // Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
 
 package org.forester.phylogeny.data;
 
@@ -61,6 +61,12 @@ public class Distribution implements PhylogenyData {
     }
 
     public boolean isEmpty() {
+        if ( ForesterUtil.isEmpty( _desc ) && ( ( getPoints() != null ) && ( getPoints().size() == 1 ) )
+                && ForesterUtil.isEmpty( _polygons ) ) {
+            if ( Point.isSeemsEmpty( getPoints().get( 0 ) ) ) {
+                return true;
+            }
+        }
         return ForesterUtil.isEmpty( _desc ) && ForesterUtil.isEmpty( _points ) && ForesterUtil.isEmpty( _polygons );
     }
 
@@ -79,7 +85,7 @@ public class Distribution implements PhylogenyData {
         int i = 0;
         if ( getPoints() != null ) {
             for( final Point point : getPoints() ) {
-                if ( point != null ) {
+                if ( ( point != null ) && !Point.isSeemsEmpty( point ) ) {
                     sb.append( ForesterUtil.LINE_SEPARATOR );
                     sb.append( " Point " + i + ": " );
                     sb.append( point.asSimpleText() );
@@ -162,12 +168,16 @@ public class Distribution implements PhylogenyData {
         final String ind = indentation + PhylogenyWriter.PHYLO_XML_INTENDATION_BASE;
         if ( getPoints() != null ) {
             for( final Point point : getPoints() ) {
-                point.toPhyloXML( writer, level, ind );
+                if ( ( point != null ) && !Point.isSeemsEmpty( point ) ) {
+                    point.toPhyloXML( writer, level, ind );
+                }
             }
         }
         if ( getPolygons() != null ) {
             for( final Polygon polygon : getPolygons() ) {
-                polygon.toPhyloXML( writer, level, ind );
+                if ( polygon != null ) {
+                    polygon.toPhyloXML( writer, level, ind );
+                }
             }
         }
         writer.write( ForesterUtil.LINE_SEPARATOR );