/** * Returns a new object indicating the states at the tips (used whether or not History is * reconstruction) */ public CharacterDistribution getStatesAtTips(Tree tree) { if (observedStates != null) return (CharacterDistribution) observedStates.getAdjustableClone(); else { ContinuousAdjustable d = new ContinuousAdjustable(tree.getTaxa(), tree.getTaxa().getNumTaxa()); d.setItemsAs(this); fillDistribution(tree, tree.getRoot(), d); return d; } }
/*..........................................ContinuousHistory................*/ private void fillDistribution(Tree tree, int node, ContinuousAdjustable dist) { if (tree.nodeIsTerminal(node)) { int t = tree.taxonNumberOfNode(node); for (int i = 0; i < getNumItems(); i++) dist.setState(t, i, getState(node, i)); } else for (int d = tree.firstDaughterOfNode(node); tree.nodeExists(d); d = tree.nextSisterOfNode(d)) fillDistribution(tree, d, dist); }