コード例 #1
0
 /**
  * This readjust procedure can be called to readjust the size of storage of states of a character
  * for nodes.
  */
 public CharacterHistory adjustSize(Tree tree) {
   if (tree.getNumNodeSpaces() == this.getNumNodes()) return this;
   else {
     ContinuousHistory soc =
         new ContinuousHistory(
             tree.getTaxa(), tree.getNumNodeSpaces(), (ContinuousData) getParentData());
     soc.setItemsAs(this);
     soc.setParentData(getParentData());
     soc.setParentCharacter(getParentCharacter());
     ((CharacterStates) soc).setExplanation(getExplanation());
     return soc;
   }
 }
コード例 #2
0
 /*..........................................ContinuousHistory................*/
 public CharacterHistory clone(CharacterHistory s) {
   ContinuousHistory snew;
   if ((s == null) || (s.getNumNodes() != numNodes) || (!(s instanceof ContinuousHistory)))
     snew = new ContinuousHistory(getTaxa(), numNodes, (ContinuousData) data);
   else {
     snew = (ContinuousHistory) s;
     snew.data = data;
   }
   snew.setItemsAs(this);
   for (int i = 0; i < numNodes; i++) {
     for (int im = 0; im < getNumItems(); im++) snew.setState(i, im, getState(i, im));
   }
   snew.characterNumber = characterNumber;
   if (observedStates != null)
     snew.setObservedStates((CharacterDistribution) observedStates.getAdjustableClone());
   snew.setExplanation(getExplanation());
   return snew;
 }