本文整理汇总了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++;
}
}
示例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);
}
}
}
示例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);
}
}
示例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++;
}
}
示例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);
}
示例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;
}