コード例 #1
0
 /*..........................................ContinuousHistory................*/
 public void calcMinMaxStates(Tree tree, int node) {
   for (int i = 0; i < getNumItems(); i++) {
     double s = getState(node, i);
     maxState = MesquiteDouble.maximum(maxState, s);
     minState = MesquiteDouble.minimum(minState, s);
   }
   for (int d = tree.firstDaughterOfNode(node); tree.nodeExists(d); d = tree.nextSisterOfNode(d))
     calcMinMaxStates(tree, d);
 }
コード例 #2
0
 /**
  * Must be called before a tree is shaded. Goes through all nodes to find states present, to set
  * minima and maxima.
  */
 public void prepareColors(Tree tree, int drawnRoot) {
   minState = MesquiteDouble.unassigned;
   maxState = MesquiteDouble.unassigned;
   calcMinMaxStates(tree, drawnRoot);
   if (getParentData() != null && getParentCharacter() >= 0) {
     int ic = getParentCharacter();
     ContinuousData data = ((ContinuousData) getParentData());
     for (int it = 0; it < data.getNumTaxa(); it++) {
       double s = data.getState(ic, it, 0);
       maxState = MesquiteDouble.maximum(maxState, s);
       minState = MesquiteDouble.minimum(minState, s);
     }
   } else if (getObservedStates() != null) {
     int ic = getParentCharacter();
     ContinuousDistribution data = (ContinuousDistribution) getObservedStates();
     for (int it = 0; it < data.getNumNodes(); it++) {
       double s = data.getState(it);
       maxState = MesquiteDouble.maximum(maxState, s);
       minState = MesquiteDouble.minimum(minState, s);
     }
   }
 }