/*---------------------------------------------------------------------------------------------------------------------- | Adds taxon label 's' to end of list of taxon labels and increments ntax by 1. Returns index of taxon label just | added. */ unsigned NxsTaxaBlock::AddTaxonLabel( NxsString s) /* the taxon label to add */ { isEmpty = false; if (s.QuotesNeeded()) needsQuotes.push_back(true); else needsQuotes.push_back(false); taxonLabels.push_back(s); ntax++; return (ntax-1); }
/*---------------------------------------------------------------------------------------------------------------------- | Changes the label for taxon 'i' to 's'. */ void NxsTaxaBlock::ChangeTaxonLabel( unsigned i, /* the taxon label number to change */ NxsString s) /* the string used to replace label i */ { assert(i < (unsigned)taxonLabels.size()); if (s.QuotesNeeded()) needsQuotes[i] = true; else needsQuotes[i] = false; taxonLabels[i] = s; }
/*! Returns true if taxonLabels[i] contains embedded spaces and thus should be surrounded by single quotes if output is NEXUS format. */ bool NxsTaxaBlock::NeedsQuotes( unsigned i) /* the taxon label number in question */ { const NxsString x(GetTaxonLabel(i).c_str()); return x.QuotesNeeded(); }