lphy.base.function.tree.TreeLength Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lphy-base Show documentation
Show all versions of lphy-base Show documentation
The standard library of LPhy, which contains the required generative distributions and basic functions.
The newest version!
package lphy.base.function.tree;
import lphy.base.evolution.tree.TimeTree;
import lphy.core.model.DeterministicFunction;
import lphy.core.model.Value;
import lphy.core.model.annotation.GeneratorCategory;
import lphy.core.model.annotation.GeneratorInfo;
import lphy.core.model.annotation.ParameterInfo;
import lphy.core.model.datatype.DoubleValue;
/**
* use {@link TimeTree#treeLength()}
*/
@Deprecated
public class TreeLength extends DeterministicFunction {
final String paramName;
public TreeLength(@ParameterInfo(name = "tree", description = "the tree.") Value x) {
paramName = getParamName(0);
setParam(paramName, x);
}
@GeneratorInfo(name="treeLength",
category = GeneratorCategory.TREE, examples = {"simpleCalibratedYule.lphy","simpleExtantBirthDeath.lphy"},
description = "The sum of all the branch lengths in the tree.")
public Value apply() {
Value v = (Value)getParams().get(paramName);
return new DoubleValue(v.value().treeLength(), this);
}
}