本文整理汇总了Java中pal.tree.ReadTree类的典型用法代码示例。如果您正苦于以下问题:Java ReadTree类的具体用法?Java ReadTree怎么用?Java ReadTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReadTree类属于pal.tree包,在下文中一共展示了ReadTree类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTreeString
import pal.tree.ReadTree; //导入依赖的package包/类
public void setTreeString(String tree) throws TreeParseException {
this.treeString = tree;
if (tree == null)
throw new TreeParseException("Attempting to set a null tree");
StringReader sr = new StringReader(tree);
this.tree = new ReadTree(new PushbackReader(sr));
}
示例2: doConsense
import pal.tree.ReadTree; //导入依赖的package包/类
/**
* This method represents the application code that we'd like to run on a
* separate thread.
*/
// Object doConsense()
private Consensus doConsense() {
List<WeightedTree> treeList = new ArrayList<WeightedTree>();
for (Model m : confidenceModels) {
try {
// parse tree
String tree = m.getTreeString();
StringReader sr = new StringReader(tree);
Tree t = new ReadTree(new PushbackReader(sr));
double weight;
// set criterion
switch (criterion.getType()) {
case InformationCriterion.IC_AIC:
weight = m.getAICw();
break;
case InformationCriterion.IC_AICc:
weight = m.getAICcw();
break;
case InformationCriterion.IC_BIC:
weight = m.getBICw();
break;
case InformationCriterion.IC_DT:
weight = m.getDTw();
break;
default:
weight = 0.0d;
}
treeList.add(new WeightedTree(t, weight));
} catch (TreeParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
double consensusThreshold;
if (consensusType.equals("strict")) {
consensusThreshold = 0.99999999d;
} else {
consensusThreshold = 0.5d;
}
;
Consensus consensus = new Consensus(treeList, consensusThreshold,
Consensus.BRANCH_LENGTHS_MEDIAN);
return consensus;
}