// 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;
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;
+ public enum NODE_DATA {
+ NODE_NAME,
+ EVENT,
+ SEQUENCE_NAME,
+ GENE_NAME,
+ SEQUENCE_SYMBOL,
+ SEQUENCE_MOL_SEQ,
+ SEQUENCE_MOL_SEQ_FASTA,
+ SEQUENCE_ACC,
+ TAXONOMY_SCIENTIFIC_NAME,
+ TAXONOMY_COMM0N_NAME,
+ 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;
public NodeData() {
init();
if ( isHasEvent() ) {
new_data.setEvent( ( Event ) getEvent().copy() );
}
- if ( isHasNodeIdentifier() ) {
- new_data.setNodeIdentifier( ( Identifier ) getNodeIdentifier().copy() );
- }
if ( ( getTaxonomies() != null ) && ( getTaxonomies().size() > 0 ) ) {
new_data.setTaxonomies( new ArrayList<Taxonomy>() );
for( final Taxonomy t : getTaxonomies() ) {
}
}
}
+ 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() );
}
return _event;
}
- public Identifier getNodeIdentifier() {
- return _node_identifier;
- }
-
public PropertiesMap getProperties() {
return _properties;
}
@Override
public boolean isEqual( final PhylogenyData data ) {
- throw new UnsupportedOperationException();
+ throw new NoSuchMethodError();
}
public boolean isHasBinaryCharacters() {
return getBinaryCharacters() != null;
}
+ public boolean isEmpty() {
+ return ( ForesterUtil.isEmpty( _node_name ) && !isHasSequence() && !isHasTaxonomy() && !isHasBinaryCharacters()
+ && !isHasDate() && !isHasDistribution() && !isHasEvent() && !isHasProperties() && !isHasReference() && ( ( _vector == null ) || _vector
+ .isEmpty() ) );
+ }
+
public boolean isHasDate() {
return ( getDate() != null )
&& ( !ForesterUtil.isEmpty( getDate().getDesc() ) || !ForesterUtil.isNull( getDate().getMax() )
return getEvent() != null;
}
- public boolean isHasNodeIdentifier() {
- return getNodeIdentifier() != null;
- }
-
public boolean isHasProperties() {
- return getProperties() != null;
+ return ( getProperties() != null ) && ( getProperties().size() > 0 );
}
public boolean isHasReference() {
_event = event;
}
- public void setNodeIdentifier( final Identifier node_identifier ) {
- _node_identifier = node_identifier;
- }
-
public void setProperties( final PropertiesMap custom_data ) {
_properties = custom_data;
}
@Override
public StringBuffer toNHX() {
final StringBuffer sb = new StringBuffer();
- if ( isHasNodeIdentifier() ) {
- sb.append( getNodeIdentifier().toNHX() );
- }
if ( isHasTaxonomy() ) {
sb.append( getTaxonomy().toNHX() );
}
if ( isHasEvent() ) {
sb.append( getEvent().toNHX() );
}
- if ( isHasProperties() ) {
- sb.append( getProperties().toNHX() );
- }
return sb;
}
@Override
public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException {
- if ( isHasNodeIdentifier() ) {
- writer.write( ForesterUtil.LINE_SEPARATOR );
- writer.write( indentation );
- // if ( !org.forester.util.ForesterUtil.isEmpty( getNodeIdentifier().getProvider() ) ) {
- // PhylogenyDataUtil.appendElement( writer, PhyloXmlMapping.NODE_IDENTIFIER, getNodeIdentifier()
- // .getValue(), PhyloXmlMapping.IDENTIFIER_PROVIDER_ATTR, getNodeIdentifier().getProvider() );
- // }
- // else {
- // PhylogenyDataUtil.appendElement( writer, PhyloXmlMapping.NODE_IDENTIFIER, getNodeIdentifier()
- // .getValue() );
- // }
- }
if ( isHasTaxonomy() ) {
for( final Taxonomy t : getTaxonomies() ) {
if ( !t.isEmpty() ) {
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;
+ }
}