当前位置: 首页>>代码示例>>Java>>正文


Java ASTNode.getChild方法代码示例

本文整理汇总了Java中org.sbml.jsbml.ASTNode.getChild方法的典型用法代码示例。如果您正苦于以下问题:Java ASTNode.getChild方法的具体用法?Java ASTNode.getChild怎么用?Java ASTNode.getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sbml.jsbml.ASTNode的用法示例。


在下文中一共展示了ASTNode.getChild方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replaceArgument

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public static void replaceArgument(ASTNode formula, String bvar, ASTNode arg)
{
	int n = 0;
	for (int i = 0; i < formula.getChildCount(); i++)
	{
		ASTNode child = formula.getChild(i);
		if (child.isSetName() && child.getName().equals(bvar))
		{
			formula.replaceChild(n, deepCopy(arg));
		}
		else if (child.getChildCount() > 0)
		{
			replaceArgument(child, bvar, arg);
		}
		n++;
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:18,代码来源:SBMLutilities.java

示例2: getAllASTNodeChildren

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
/**
 * recursively puts every astnode child into the arraylist passed in
 * 
 * @param node
 * @param nodeChildrenList
 */
protected static void getAllASTNodeChildren(ASTNode node, ArrayList<ASTNode> nodeChildrenList)
{

	for (int i = 0; i < node.getChildCount(); i++)
	{
		ASTNode child = node.getChild(i);
		if (child.getChildCount() == 0)
		{
			nodeChildrenList.add(child);
		}
		else
		{
			nodeChildrenList.add(child);
			getAllASTNodeChildren(child, nodeChildrenList);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:24,代码来源:SBMLutilities.java

示例3: getAllASTNodeChildren

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public static void getAllASTNodeChildren(ASTNode node, ArrayList<ASTNode> nodeChildrenList)
{

	ASTNode child;
	long size = node.getChildCount();

	if (node.getChildCount() == 0)
	{
		nodeChildrenList.add(node);
	}

	for (int i = 0; i < size; i++)
	{
		// TODO:check this
		child = node.getChild(i);
		nodeChildrenList.add(child);
		getAllASTNodeChildren(child, nodeChildrenList);
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:20,代码来源:HierarchicalUtilities.java

示例4: replaceArgument

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public void replaceArgument(ASTNode formula, String bvar, ASTNode arg)
{
	int n = 0;
	for (int i = 0; i < formula.getChildCount(); i++)
	{
		ASTNode child = formula.getChild(i);
		if (child.isString() && child.getName().equals(bvar))
		{
			formula.replaceChild(n, arg.clone());
		}
		else if (child.getChildCount() > 0)
		{
			replaceArgument(child, bvar, arg);
		}
		n++;
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:18,代码来源:Simulator.java

示例5: removeBooleanAssign

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public String removeBooleanAssign(ASTNode math) {
	if (math.getType() == ASTNode.Type.FUNCTION_PIECEWISE && math.getChildCount() > 1) {
		ASTNode result = math.getChild(1);
		for (int j = 0; j < sbml.getModel().getParameterCount(); j++) {
			Parameter parameter = sbml.getModel().getParameter(j);
			if (SBMLutilities.isBoolean(parameter)) {
				result = SBMLutilities.removeBoolean(result,parameter.getId());
			}
		}
		return SBMLutilities.myFormulaToString(result);
	}
	return SBMLutilities.myFormulaToString(math);
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:14,代码来源:BioModel.java

示例6: inlineFormula

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
/**
 * inlines a formula with function definitions
 * 
 * @param formula
 * @return
 */
protected ASTNode inlineFormula(ASTNode formula)
{

	if (formula.isFunction() == false || formula.isOperator()/* || formula.isLeaf() == false */)
	{

		for (int i = 0; i < formula.getChildCount(); ++i)
		{
			formula.replaceChild(i, inlineFormula(formula.getChild(i)));// .clone()));
		}
	}
	else if (formula.isFunction() && model.getFunctionDefinition(formula.getName()) != null)
	{

		if (ibiosimFunctionDefinitions.contains(formula.getName()))
		{
			return formula;
		}

		ASTNode inlinedFormula = model.getFunctionDefinition(formula.getName()).getBody().clone();
		ASTNode oldFormula = formula.clone();

		ArrayList<ASTNode> inlinedChildren = new ArrayList<ASTNode>();
		this.getAllASTNodeChildren(inlinedFormula, inlinedChildren);

		if (inlinedChildren.size() == 0)
		{
			inlinedChildren.add(inlinedFormula);
		}

		HashMap<String, Integer> inlinedChildToOldIndexMap = new HashMap<String, Integer>();

		for (int i = 0; i < model.getFunctionDefinition(formula.getName()).getArgumentCount(); ++i)
		{
			inlinedChildToOldIndexMap.put(model.getFunctionDefinition(formula.getName()).getArgument(i).getName(), i);
		}

		for (int i = 0; i < inlinedChildren.size(); ++i)
		{

			ASTNode child = inlinedChildren.get(i);

			if (child.isLeaf() && child.isName())
			{

				int index = inlinedChildToOldIndexMap.get(child.getName());
				replaceArgument(inlinedFormula, child.toFormula(), oldFormula.getChild(index));

				if (inlinedFormula.getChildCount() == 0)
				{
					inlinedFormula = oldFormula.getChild(index);
				}
			}
		}

		return inlinedFormula;
	}
	return formula;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:66,代码来源:Simulator.java


注:本文中的org.sbml.jsbml.ASTNode.getChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。