// Copyright (C) 2008-2009 Christian M. Zmasek
// Copyright (C) 2008-2009 Burnham Institute for Medical Research
// 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
private String _taxonomy_code;
private String _rank;
private List<Uri> _uris;
+ private List<String> _lineage;
public Taxonomy() {
init();
}
+ @Override
public StringBuffer asSimpleText() {
return asText();
}
+ @Override
public Uri getUri( final int index ) {
return getUris().get( index );
}
+ @Override
public void addUri( final Uri uri ) {
if ( getUris() == null ) {
setUris( new ArrayList<Uri>() );
getUris().add( uri );
}
+ @Override
public StringBuffer asText() {
final StringBuffer sb = new StringBuffer();
if ( getIdentifier() != null ) {
return sb;
}
+ @Override
public PhylogenyData copy() {
final Taxonomy t = new Taxonomy();
t.setTaxonomyCode( getTaxonomyCode() );
}
}
}
+ if ( getLineage() != null ) {
+ t.setLineage( new ArrayList<String>() );
+ for( final String l : getLineage() ) {
+ if ( l != null ) {
+ t.getLineage().add( l );
+ }
+ }
+ }
return t;
}
return _taxonomy_code;
}
+ @Override
public List<Uri> getUris() {
return _uris;
}
setAuthority( "" );
setSynonyms( null );
setUris( null );
+ setLineage( null );
}
public boolean isEmpty() {
return ( ( getIdentifier() == null ) && ForesterUtil.isEmpty( getTaxonomyCode() )
&& ForesterUtil.isEmpty( getCommonName() ) && ForesterUtil.isEmpty( getScientificName() )
&& ForesterUtil.isEmpty( getRank() ) && ForesterUtil.isEmpty( _uris )
- && ForesterUtil.isEmpty( getAuthority() ) && ForesterUtil.isEmpty( _synonyms ) );
+ && ForesterUtil.isEmpty( getAuthority() ) && ForesterUtil.isEmpty( _synonyms ) && ForesterUtil
+ .isEmpty( _lineage ) );
}
/**
* (Note. This is important and should not be change without a very good reason.)
*
*/
+ @Override
public boolean isEqual( final PhylogenyData data ) {
if ( this == data ) {
return true;
}
public void setRank( final String rank ) {
- if ( !ForesterUtil.isEmpty( rank ) && !PhyloXmlUtil.TAXONOMY_RANKS.contains( rank ) ) {
+ if ( !ForesterUtil.isEmpty( rank ) && !PhyloXmlUtil.TAXONOMY_RANKS_SET.contains( rank ) ) {
throw new PhyloXmlDataFormatException( "illegal rank: [" + rank + "]" );
}
_rank = rank;
_taxonomy_code = taxonomy_code;
}
+ @Override
public void setUris( final List<Uri> uris ) {
_uris = uris;
}
+ @Override
public StringBuffer toNHX() {
final StringBuffer sb = new StringBuffer();
if ( getIdentifier() != null ) {
return sb;
}
+ @Override
public void toPhyloXML( final Writer writer, final int level, final String indentation ) throws IOException {
if ( isEmpty() ) {
return;
}
return 0;
}
+
+ public void setLineage( final List<String> lineage ) {
+ _lineage = lineage;
+ }
+
+ public List<String> getLineage() {
+ return _lineage;
+ }
}