lphy.base.parser.nexus.TaxaBlock Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lphy-base Show documentation
Show all versions of lphy-base Show documentation
The standard library of LPhy, which contains the required generative distributions and basic functions.
The newest version!
/*
* Copyright (C) 2014 Tim Vaughan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package lphy.base.parser.nexus;
import java.util.ArrayList;
import java.util.List;
/**
* Nexus Taxa block.
*
* @author Tim Vaughan <[email protected]>
*/
public class TaxaBlock extends NexusBlock {
private final String[] taxa;
public TaxaBlock(String[] taxa) {
this.taxa = taxa;
}
@Override
public String getBlockName() {
return "taxa";
}
@Override
public List getBlockLines() {
List lines = new ArrayList<>();
int ntax = taxa.length;
lines.add("dimensions ntax=" + ntax);
StringBuilder taxLabels = new StringBuilder("taxlabels");
for (int i=0; i