コード例 #1
0
  // TODO: here should use super.setToClone(data) to handle specssets etc.???
  public CharacterData cloneDataBlock(int icStart, int icEnd, int itStart, int itEnd) {
    int blockChars = icEnd - icStart + 1;
    int blockTaxa = itEnd - itStart + 1;
    boolean[] taxaToClone = new boolean[getNumTaxa()];
    for (int it = 0; it < getNumTaxa(); it++) {
      taxaToClone[it] = it >= itStart && it <= itEnd;
    }
    Taxa taxa = getTaxa().cloneTaxa(taxaToClone);

    ContinuousData cD = new GeographicData(getMatrixManager(), blockTaxa, blockChars, taxa);
    int nItems = getNumItems();
    cD.setItemsAs(this);
    for (int i = 0; i < nItems; i++) {
      Double2DArray imatrix = null;
      imatrix = cD.getItem(i);
      Double2DArray oldMatrix = getItem(i);
      for (int ic = icStart; ic <= icEnd; ic++)
        for (int it = itStart; it <= itEnd; it++)
          imatrix.setValue(ic - icStart, it - itStart, oldMatrix.getValue(ic, it));
    }
    for (int ic = 0; ic < numChars; ic++) if (getSelected(ic)) cD.setSelected(ic - icStart, true);

    return cD;
  }
コード例 #2
0
 /*..........................................MContinuousStates................*/
 public double[][] getMatrix(int index) {
   Double2DArray m2da = getItem(index);
   if (m2da == null) return null;
   return m2da.getMatrix();
 }