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


Java ASTNode.isFunction方法代码示例

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


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

示例1: getSatisfyingNodes

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
/**
 * recursively puts the nodes that have the same name as the quarry string
 * passed in into the arraylist passed in so, the entire tree is searched
 * through, which i don't think is possible with the jsbml methods
 * 
 * @param node
 *            node to search through
 * @param quarry
 *            string to search for
 * @param satisfyingNodes
 *            list of nodes that satisfy the condition
 */
static void getSatisfyingNodes(ASTNode node, String quarry, ArrayList<ASTNode> satisfyingNodes)
{

	if (node.isName() && node.getName().equals(quarry))
	{
		satisfyingNodes.add(node);
	}
	else if (node.isFunction() && node.getName().equals(quarry))
	{
		satisfyingNodes.add(node);
	}
	else
	{
		for (ASTNode childNode : node.getChildren())
		{
			getSatisfyingNodes(childNode, quarry, satisfyingNodes);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:32,代码来源:Simulator.java

示例2: getSatisfyingNodesLax

import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
/**
 * recursively puts the nodes that have the same name as the quarry string
 * passed in into the arraylist passed in so, the entire tree is searched
 * through, which i don't think is possible with the jsbml methods the lax
 * version uses contains instead of equals
 * 
 * @param node
 *            node to search through
 * @param quarry
 *            string to search for
 * @param satisfyingNodes
 *            list of nodes that satisfy the condition
 */
void getSatisfyingNodesLax(ASTNode node, String quarry, ArrayList<ASTNode> satisfyingNodes)
{

	if (node.isName() && node.getName().contains(quarry))
	{
		satisfyingNodes.add(node);
	}
	else if (node.isFunction() && node.getName().contains(quarry))
	{
		satisfyingNodes.add(node);
	}
	else
	{
		for (ASTNode childNode : node.getChildren())
		{
			getSatisfyingNodesLax(childNode, quarry, satisfyingNodes);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:33,代码来源:Simulator.java

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