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


Java ASTNode.getChildCount方法代码示例

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


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

示例1: setTimeToT

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
/**
 * Recursive function to change time variable to t
 */
public static void setTimeToT(ASTNode node)
{
	if (node == null)
	{
		return;
	}
	if (node.getType() == ASTNode.Type.NAME_TIME)
	{
		if (node.getName()==null || !node.getName().equals("t") || !node.getName().equals("time"))
		{
			node.setName("t");
		}
	}
	else if (node.getType() == ASTNode.Type.NAME_AVOGADRO)
	{
		node.setName("avogadro");
	}
	for (int c = 0; c < node.getChildCount(); c++)
	{
		setTimeToT(node.getChild(c));
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java

示例2: removePreset

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public static ASTNode removePreset(ASTNode math, String place)
{
	if (math.getType() == ASTNode.Type.LOGICAL_AND)
	{
		ASTNode rightChild = math.getRightChild();
		if (rightChild.getType() == ASTNode.Type.RELATIONAL_EQ && rightChild.getLeftChild().toFormula().equals(place))
		{
			return deepCopy(math.getLeftChild());
		}
	}
	for (int i = 0; i < math.getChildCount(); i++)
	{
		ASTNode child = removePreset(math.getChild(i), place);
		math.replaceChild(i, child);
	}
	return deepCopy(math);
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:18,代码来源:SBMLutilities.java

示例3: removeBoolean

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public static ASTNode removeBoolean(ASTNode math, String boolVar)
{
	if (math == null)
	{
		return null;
	}
	if (math.getType() == ASTNode.Type.RELATIONAL_EQ)
	{
		if (math.getLeftChild().isSetName() && math.getLeftChild().getName().equals(boolVar))
		{
			return deepCopy(math.getLeftChild());
		}
	}
	for (int i = 0; i < math.getChildCount(); i++)
	{
		ASTNode child = removeBoolean(math.getChild(i), boolVar);
		math.replaceChild(i, child);
	}
	return deepCopy(math);
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:21,代码来源:SBMLutilities.java

示例4: 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

示例5: 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

示例6: 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

示例7: splitMath

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public static ASTNode[] splitMath(ASTNode math)
{
	ASTNode plus = new ASTNode(Type.PLUS);
	ASTNode minus = new ASTNode(Type.PLUS);
	ASTNode[] result = new ASTNode[] { plus, minus };
	List<ASTNode> nodes = RateSplitterInterpreter.parseASTNode(math);
	for (ASTNode node : nodes)
	{
		if (node.getType() == ASTNode.Type.MINUS)
		{
			minus.addChild(node.getChild(0));
		}
		else
		{
			plus.addChild(node);
		}
	}

	return plus.getChildCount() > 0 && minus.getChildCount() > 0 ? result : null;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:21,代码来源:HierarchicalUtilities.java

示例8: getAllASTNodeChildren

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

	for (ASTNode child : node.getChildren())
	{

		if (child.getChildCount() == 0)
		{
			nodeChildrenList.add(child);
		}
		else
		{
			nodeChildrenList.add(child);
			getAllASTNodeChildren(child, nodeChildrenList);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:24,代码来源:Simulator.java

示例9: 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

示例10: parseMathHelper

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
private LinkedList<String> parseMathHelper(ASTNode astNode) {
	LinkedList<String> inputs = new LinkedList<String>();
	if (!astNode.isOperator() && !astNode.isNumber())
		inputs.add(astNode.getName());
	for (int i = 0; i < astNode.getChildCount(); i++) {
		inputs.addAll(parseMathHelper(astNode.getListOfNodes().get(i)));
	}
	return inputs;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:10,代码来源:AssemblyGraph2.java

示例11: replaceParams

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public ASTNode replaceParams(ASTNode formula, HashMap<String,String> parameters) {
	if (formula.getChildCount() > 0) {
		for (int i = 0; i < formula.getChildCount(); i ++) {
			formula.replaceChild(i, replaceParams(formula.getChild(i), parameters));
		}
	}
	else if (parameters.keySet().contains(formula.getName())) {
		return SBMLutilities.myParseFormula(parameters.get(formula.getName()));
	}
	return formula;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:12,代码来源:BioModel.java

示例12: 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

示例13: isBoolean

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public static boolean isBoolean(SBMLDocument document, ASTNode node)
{
	if (node == null)
	{
		return false;
	}
	else if (node.isBoolean())
	{
		return true;
	}
	else if (node.getType() == ASTNode.Type.FUNCTION)
	{
		FunctionDefinition fd = document.getModel().getFunctionDefinition(node.getName());
		if (fd != null && fd.isSetMath())
		{
			return isBoolean(document, fd.getMath().getRightChild());
		}
		return false;
	}
	else if (node.getType() == ASTNode.Type.FUNCTION_PIECEWISE)
	{
		for (int c = 0; c < node.getChildCount(); c += 2)
		{
			if (!isBoolean(document, node.getChild(c)))
			{
				return false;
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:33,代码来源:SBMLutilities.java

示例14: SBMLMathToBoolLPNString

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
public static String SBMLMathToBoolLPNString(ASTNode math, HashMap<String, Integer> constants, ArrayList<String> booleans)
{
	if (math.getType() == ASTNode.Type.FUNCTION_PIECEWISE && math.getChildCount() > 1)
	{
		return SBMLMathToLPNString(math.getChild(1), constants, booleans);
	}
	return SBMLMathToLPNString(math, constants, booleans);
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:9,代码来源:SBMLutilities.java

示例15: replaceFunctionDefinition

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
private ASTNode replaceFunctionDefinition(ASTNode equation, ListOf<FunctionDefinition> functions) {
	if (equation.getType() == ASTNode.Type.FUNCTION) {
		FunctionDefinition fd = functions.get(equation.getName());
		ASTNode newNode = fd.getBody();
		for (int i = 0; i < fd.getArgumentCount(); i++) {
			newNode = replace(fd.getArgument(i).getName(), equation.getChild(i), newNode);
		}
		return newNode;
	}
	for (int i = 0; i < equation.getChildCount(); i++) {
		equation.replaceChild(i, replaceFunctionDefinition(equation.getChild(i), functions));
	}
	return equation;
}
 
开发者ID:dreal,项目名称:biology,代码行数:15,代码来源:ODEModel.java


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