X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fphylogeny%2Fdata%2FTaxonomy.java;h=b35492170af7fd4e5a3fe3371780693f9029a0ab;hb=a1e88a27d4df0836cd947b7140b37bb7a0b16077;hp=026d68bfd9608f41bae079ea57bef89c0d9c9c71;hpb=48f7a89be9d34f1930a1f863e608235cc27184c5;p=jalview.git diff --git a/forester/java/src/org/forester/phylogeny/data/Taxonomy.java b/forester/java/src/org/forester/phylogeny/data/Taxonomy.java index 026d68b..b354921 100644 --- a/forester/java/src/org/forester/phylogeny/data/Taxonomy.java +++ b/forester/java/src/org/forester/phylogeny/data/Taxonomy.java @@ -5,7 +5,7 @@ // 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 @@ -15,13 +15,13 @@ // 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; @@ -46,19 +46,23 @@ public class Taxonomy implements PhylogenyData, MultipleUris, Comparable _uris; + private List _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() ); @@ -66,6 +70,7 @@ public class Taxonomy implements PhylogenyData, MultipleUris, Comparable() ); for( final Uri uri : getUris() ) { @@ -125,6 +141,14 @@ public class Taxonomy implements PhylogenyData, MultipleUris, Comparable() ); + for( final String l : getLineage() ) { + if ( l != null ) { + t.getLineage().add( l ); + } + } + } return t; } @@ -176,13 +200,14 @@ public class Taxonomy implements PhylogenyData, MultipleUris, Comparable getUris() { return _uris; } @Override public int hashCode() { - if ( getIdentifier() != null ) { + if ( ( getIdentifier() != null ) && !ForesterUtil.isEmpty( getIdentifier().getValue() ) ) { return getIdentifier().hashCode(); } else if ( !ForesterUtil.isEmpty( getTaxonomyCode() ) ) { @@ -203,18 +228,30 @@ public class Taxonomy implements PhylogenyData, MultipleUris, Comparable uris ) { _uris = uris; } + @Override public StringBuffer toNHX() { final StringBuffer sb = new StringBuffer(); if ( getIdentifier() != null ) { @@ -322,6 +364,7 @@ public class Taxonomy implements PhylogenyData, MultipleUris, Comparable lineage ) { + _lineage = lineage; + } + + public List getLineage() { + return _lineage; + } }