Esempio n. 1
0
 public int sizeOfIntersection(TaxonList tl1, TaxonList tl2) {
   int nIn = 0;
   for (int j = 0; j < tl1.getTaxonCount(); ++j) {
     if (tl2.getTaxonIndex(tl1.getTaxon(j)) >= 0) {
       ++nIn;
     }
   }
   return nIn;
 }
Esempio n. 2
0
 /** constructor taking a dimension */
 public DistanceMatrix(TaxonList taxa) {
   super();
   this.taxa = taxa;
   dimension = taxa.getTaxonCount();
   distances = new double[dimension][dimension];
   distancesKnown = true;
 }
  private boolean isUnique(TaxonList taxonList, Tree tree, NodeRef node) {
    Set<String> taxa = Tree.Utils.getDescendantLeaves(tree, node);
    int count = 0;
    for (String taxon : taxa) {
      count += (taxonList.getTaxonIndex(taxon) >= 0 ? 1 : 0);
      // System.out.print(taxon + "\t");
    }
    boolean unique = (count == 0) || (count == taxa.size());

    // System.out.println(count + "\t" + unique);

    return unique;
  }
Esempio n. 4
0
 public boolean contained(TaxonList taxons, TaxonList taxons1) {
   return sizeOfIntersection(taxons, taxons1) == taxons.getTaxonCount();
 }