當前位置: 首頁>>代碼示例>>Java>>正文


Java MutableTree.InvalidTreeException方法代碼示例

本文整理匯總了Java中dr.evolution.tree.MutableTree.InvalidTreeException方法的典型用法代碼示例。如果您正苦於以下問題:Java MutableTree.InvalidTreeException方法的具體用法?Java MutableTree.InvalidTreeException怎麽用?Java MutableTree.InvalidTreeException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dr.evolution.tree.MutableTree的用法示例。


在下文中一共展示了MutableTree.InvalidTreeException方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doOperation

import dr.evolution.tree.MutableTree; //導入方法依賴的package包/類
public double doOperation() {
    if( tree.getInternalNodeCount() < 2 ) {
        throw new RuntimeException("no node found");
    }

    tree.beginTreeEdit();

    switch( nodesToMove ) {
        case 2: move2(); break;
        case 3: move3(); break;
    }

    tree.endTreeEdit();

    // AR not sure whether this check is needed...
    try {
        tree.checkTreeIsValid();
    } catch( MutableTree.InvalidTreeException ite ) {
        throw new RuntimeException(ite.toString());
    }

    return 0;
}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:24,代碼來源:TreeUniform.java

示例2: doOperation

import dr.evolution.tree.MutableTree; //導入方法依賴的package包/類
public double doOperation() throws OperatorFailedException {
    if( tree.getInternalNodeCount() < 2 ) {
        throw new OperatorFailedException("no node found");
    }

    tree.beginTreeEdit();

    switch( nodesToMove ) {
        case 2: move2(); break;
        case 3: move3(); break;
    }

    tree.endTreeEdit();

    // AR not sure whether this check is needed...
    try {
        tree.checkTreeIsValid();
    } catch( MutableTree.InvalidTreeException ite ) {
        throw new OperatorFailedException(ite.toString());
    }

    return 0;
}
 
開發者ID:whdc,項目名稱:ieo-beast,代碼行數:24,代碼來源:TreeUniform.java

示例3: eupdateARG

import dr.evolution.tree.MutableTree; //導入方法依賴的package包/類
private void eupdateARG(NodeRef i, NodeRef j, NodeRef iP, NodeRef jP) throws ARGOperatorFailedException {

		// There are three different cases:
		// 1) neither i nor j are reassortments, 2) either i or j are reassortments, 3) both i and j are reassortments

		tree.beginTreeEdit();

		boolean iBifurcation = tree.isBifurcation(i);
		boolean jBifurcation = tree.isBifurcation(j);

		if (iBifurcation && jBifurcation) {
			tree.removeChild(iP, i);
			tree.removeChild(jP, j);
			tree.addChild(jP, i);
			tree.addChild(iP, j);
		} else if (!iBifurcation && !jBifurcation) {
//            tree.singleRemoveChild(iP, i);
//            tree.singleRemoveChild(jP, j);
//            tree.singleAddChild(jP, i);
//            tree.singleAddChild(iP, j);
		} else {
			if (jBifurcation) {
				// one reassortment; force i to be bifurcation and j to be reassortment
				NodeRef t = i;
				NodeRef tP = iP;
				i = j;
				iP = jP;
				j = t;
				jP = tP;
			}
//            System.err.println(tree.toGraphString());
//            ARGModel.Node iNode = (ARGModel.Node) i;
//            ARGModel.Node jNode = (ARGModel.Node) j;
//            System.err.println("i = "+iNode.number+" : j = "+jNode.number);
			/* tree.removeChild(iP, i);
					   tree.singleRemoveChild(jP, j);
					   tree.addChild(jP, i);
					   tree.singleAddChild(iP, j);*/
		}

        tree.endTreeEdit();
		try {
            tree.checkTreeIsValid();
		} catch (MutableTree.InvalidTreeException ite) {
			throw new ARGOperatorFailedException(ite.toString());
		}
	}
 
開發者ID:beast-dev,項目名稱:beast-mcmc,代碼行數:48,代碼來源:ARGExchangeOperator.java

示例4: eupdateARG

import dr.evolution.tree.MutableTree; //導入方法依賴的package包/類
private void eupdateARG(NodeRef i, NodeRef j, NodeRef iP, NodeRef jP) throws OperatorFailedException {

		// There are three different cases:
		// 1) neither i nor j are reassortments, 2) either i or j are reassortments, 3) both i and j are reassortments

		tree.beginTreeEdit();

		boolean iBifurcation = tree.isBifurcation(i);
		boolean jBifurcation = tree.isBifurcation(j);

		if (iBifurcation && jBifurcation) {
			tree.removeChild(iP, i);
			tree.removeChild(jP, j);
			tree.addChild(jP, i);
			tree.addChild(iP, j);
		} else if (!iBifurcation && !jBifurcation) {
//            tree.singleRemoveChild(iP, i);
//            tree.singleRemoveChild(jP, j);
//            tree.singleAddChild(jP, i);
//            tree.singleAddChild(iP, j);
		} else {
			if (jBifurcation) {
				// one reassortment; force i to be bifurcation and j to be reassortment
				NodeRef t = i;
				NodeRef tP = iP;
				i = j;
				iP = jP;
				j = t;
				jP = tP;
			}
//            System.err.println(tree.toGraphString());
//            ARGModel.Node iNode = (ARGModel.Node) i;
//            ARGModel.Node jNode = (ARGModel.Node) j;
//            System.err.println("i = "+iNode.number+" : j = "+jNode.number);
			/* tree.removeChild(iP, i);
					   tree.singleRemoveChild(jP, j);
					   tree.addChild(jP, i);
					   tree.singleAddChild(iP, j);*/
		}

        tree.endTreeEdit();
		try {
            tree.checkTreeIsValid();
		} catch (MutableTree.InvalidTreeException ite) {
			throw new OperatorFailedException(ite.toString());
		}
	}
 
開發者ID:whdc,項目名稱:ieo-beast,代碼行數:48,代碼來源:ARGExchangeOperator.java


注:本文中的dr.evolution.tree.MutableTree.InvalidTreeException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。