/**
  * 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);
     }
   }
 }