コード例 #1
0
 /*.................................................................................................................*/
 public int[] getTaxonNumberTranslation(Taxa taxa) {
   int max = -1;
   for (int it = 0; it < taxa.getNumTaxa(); it++) {
     long translateNumber = getTaxonNumberInTree(taxa, it);
     if (MesquiteLong.isCombinable(translateNumber) && translateNumber > max) {
       max = (int) translateNumber;
     }
   }
   int[] translate = new int[max + 1];
   for (int it = 0; it < data.getNumTaxa(); it++) {
     long translateNumber = getTaxonNumberInTree(taxa, it);
     if (MesquiteLong.isCombinable(translateNumber) && translateNumber >= 0) {
       translate[(int) translateNumber] = it;
     }
   }
   return translate;
 }
コード例 #2
0
  /*.................................................................................................................*/
  private void recordSourceProject() {
    MesquiteString s = new MesquiteString();
    s.setValue(getProject().getHomeFileName());
    if (!QueryDialogs.queryString(
        containerOfModule(),
        "Name to Stamp",
        "Indicate source file name to stamp on matrix rows",
        s)) return;

    int numMatrices = getProject().getNumberCharMatrices();
    NameReference sourceRef = NameReference.getNameReference("SourceFile");

    for (int im = 0; im < numMatrices; im++) {
      CharacterData data = getProject().getCharacterMatrix(im);
      Taxa taxa = data.getTaxa();
      Associable tInfo = data.getTaxaInfo(true);
      boolean anySelected = taxa.anySelected();
      for (int it = 0; it < taxa.getNumTaxa(); it++) {
        if (data.hasDataForTaxon(it) && (!anySelected || taxa.getSelected(it)))
          tInfo.setAssociatedObject(sourceRef, it, s.getValue());
      }
    }
  }