use of dr.evomodel.operators.TreeNodeSlide in project beast-mcmc by beast-dev.
the class SpeciesTreeModel method scale.
public int scale(double scaleFactor, int nDims, boolean testBounds) {
assert scaleFactor > 0;
if (nDims <= 0) {
// actually when in an up down with operators on the gene trees the flags
// may indicate a change
//storeState(); // just checks assert really
beginTreeEdit();
final int count = getInternalNodeCount();
for (int i = 0; i < count; ++i) {
final NodeRef n = getInternalNode(i);
setNodeHeight(n, getNodeHeight(n) * scaleFactor);
}
endTreeEdit();
fireModelChanged(this, 1);
return count;
} else {
if (nDims != 1) {
throw new UnsupportedOperationException("not implemented for count != 1");
}
if (internalTreeOP == null) {
internalTreeOP = new TreeNodeSlide(this, species, 1);
}
internalTreeOP.operateOneNode(scaleFactor);
fireModelChanged(this, 1);
return nDims;
}
}
use of dr.evomodel.operators.TreeNodeSlide in project beast-mcmc by beast-dev.
the class TreeNodeSlideParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
SpeciesBindings species = (SpeciesBindings) xo.getChild(SpeciesBindings.class);
SpeciesTreeModel tree = (SpeciesTreeModel) xo.getChild(SpeciesTreeModel.class);
final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
//final boolean oo = xo.getAttribute("outgroup", false);
return new TreeNodeSlide(tree, species, /*, oo*/
weight);
}
Aggregations