• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ASTNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addIndices

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
public static void addIndices(SBase sBase,String attribute,String[] indices,int offset)
{
	ArraysSBasePlugin sBasePlugin = SBMLutilities.getArraysSBasePlugin(sBase);
	for(int i = sBasePlugin.getIndexCount()-1; i>=0; i--){
        Index indie = sBasePlugin.getIndex(i,attribute);
        if(indie!=null)
           sBasePlugin.removeIndex(indie);
	}
	if (indices!=null) {
		for(int i = 0; i<indices.length-offset; i++){
			Index indexRule = sBasePlugin.createIndex();
			indexRule.setArrayDimension(i);
			indexRule.setReferencedAttribute(attribute);
			ASTNode indexMath = SBMLutilities.myParseFormula(indices[i+offset]);
			indexRule.setMath(indexMath);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:19,代码来源:SBMLutilities.java


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


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


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


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


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


示例7: setupEventAssignments

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
private static void setupEventAssignments(HierarchicalSimulation sim, ModelContainer container, EventNode eventNode, Event event)
{
  HierarchicalModel modelstate = container.getHierarchicalModel();
  for (EventAssignment eventAssignment : event.getListOfEventAssignments())
  {
    String id = eventAssignment.isSetMetaId() ? eventAssignment.getMetaId() : eventAssignment.toString();
    ReplacementSetup.setupReplacement(sim, eventAssignment, id, container);
    if (eventAssignment.isSetMetaId() && modelstate.isDeletedByMetaId(eventAssignment.getMetaId()) || !eventAssignment.isSetMath())
    {
      continue;
    }
    
    if(eventAssignment.isSetMath())
    {
      ASTNode math = eventAssignment.getMath();
      VariableNode variableNode = modelstate.getNode(eventAssignment.getVariable());

      HierarchicalNode assignmentNode = MathInterpreter.parseASTNode(math, modelstate.getVariableToNodeMap(), InterpreterType.ASSIGNMENT);
      assignmentNode = convertConcentrationUnits(variableNode, assignmentNode);
      FunctionNode eventAssignmentNode = new FunctionNode(variableNode, assignmentNode);
      eventNode.addEventAssignment(eventAssignmentNode);
    }

  }
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:CoreSetup.java


示例8: setupSingleRevReaction

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
private static void setupSingleRevReaction(HierarchicalSimulation sim, HierarchicalModel modelstate, ReactionNode reactionNode, ASTNode reactionFormula, Model model)
{
  ASTNode[] splitMath = HierarchicalUtilities.splitMath(reactionFormula);
  if (splitMath == null)
  {
    HierarchicalNode math = MathInterpreter.parseASTNode(reactionFormula, null, modelstate.getVariableToNodeMap(), reactionNode.getLocalParameters(),  reactionNode, InterpreterType.RATE);
    reactionNode.setForwardRate(math);
  }
  else
  {
    HierarchicalNode forwardRate = MathInterpreter.parseASTNode(splitMath[0], null, modelstate.getVariableToNodeMap(), reactionNode.getLocalParameters(),  reactionNode, InterpreterType.RATE);
    reactionNode.setForwardRate(forwardRate);
    HierarchicalNode reverseRate = MathInterpreter.parseASTNode(splitMath[1],  null, modelstate.getVariableToNodeMap(), reactionNode.getLocalParameters(),  reactionNode, InterpreterType.RATE);
    reactionNode.setReverseRate(reverseRate);

  }
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:18,代码来源:CoreSetup.java


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


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


示例11: alterNode

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
/**
 * replaces ROWX_COLY with ROWA_COLB in a kinetic law this has to be done
 * without re-parsing the formula string because the row/col values can be
 * negative, which gets parsed incorrectly
 * 
 * @param node
 * @param oldString
 * @param newString
 */
private void alterNode(ASTNode node, String oldString, String newString)
{

	if (node.isName() && node.getName().contains(oldString))
	{
		node.setVariable(model.getSpecies(newString + "__" + node.getName().split("__")[1]));
	}
	else
	{
		for (ASTNode childNode : node.getChildren())
		{
			alterNode(childNode, oldString, newString);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:25,代码来源:Simulator.java


示例12: alterLocalParameter

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
/**
 * replaceArgument() doesn't work when you're replacing a localParameter, so
 * this does that -- finds the oldString within node and replaces it with
 * the local parameter specified by newString
 * 
 * @param node
 * @param reactionID
 * @param oldString
 * @param newString
 */
private void alterLocalParameter(ASTNode node, Reaction reaction, String oldString, String newString)
{

	// String reactionID = reaction.getId();
	if (node.isName() && node.getName().equals(oldString))
	{
		node.setVariable(reaction.getKineticLaw().getLocalParameter(newString));
	}
	else
	{
		for (ASTNode childNode : node.getChildren())
		{
			alterLocalParameter(childNode, reaction, oldString, newString);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:27,代码来源:Simulator.java


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


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


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


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


示例17: prependToVariableNodes

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
/**
 * recursively finds all variable nodes and prepends a string to the
 * variable static version
 * 
 * @param node
 * @param toPrepend
 */
private static void prependToVariableNodes(ASTNode node, String toPrepend, Model model)
{

	if (node.isName())
	{

		// only prepend to species and parameters
		if (model.getSpecies(toPrepend + node.getName()) != null)
		{
			node.setVariable(model.getSpecies(toPrepend + node.getName()));
		}
		else if (model.getParameter(toPrepend + node.getName()) != null)
		{
			node.setVariable(model.getParameter(toPrepend + node.getName()));
		}
	}
	else
	{
		for (ASTNode childNode : node.getChildren())
		{
			prependToVariableNodes(childNode, toPrepend, model);
		}
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:32,代码来源:Simulator.java


示例18: setupReactions

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
/**
 * calculates the initial propensities for each reaction in the model
 * 
 * @param numReactions
 *            the number of reactions in the model
 */
protected void setupReactions()
{

	// loop through all reactions and calculate their propensities
	for (Reaction reaction : model.getListOfReactions())
	{
		if (!reaction.isSetKineticLaw())
		{
			continue;
		}

		String reactionID = reaction.getId();
		ASTNode reactionFormula = reaction.getKineticLaw().getMath();

		setupSingleReaction(reactionID, reactionFormula, reaction.getReversible(), reaction.getListOfReactants(), reaction.getListOfProducts(), reaction.getListOfModifiers());
	}
}
 
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:24,代码来源:Simulator.java


示例19: testConstraints

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
/**
 * this evaluates a set of constraints that have been affected by an event
 * or reaction firing and returns the OR'd boolean result
 * 
 * @param affectedConstraintSet
 *            the set of constraints affected
 * @return the boolean result of the constraints' evaluation
 */
protected boolean testConstraints(HashSet<ASTNode> affectedConstraintSet)
{

	// check all of the affected constraints
	// if one evaluates to true, then the simulation halts
	for (ASTNode constraint : affectedConstraintSet)
	{

		if (getBooleanFromDouble(evaluateExpressionRecursive(constraint)) == true)
		{
			return true;
		}
	}

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


示例20: createPolynomialFunctionAST

import org.sbml.jsbml.ASTNode; //导入依赖的package包/类
/**
 * Creates the polynomial function AST that encodes the give polynomial function.
 * 
 * @param pf     polynomial function. The starting knot corresponds to zero for this function.
 * @param knot   starting knot for this function
 * 
 * @return AST node representing the function
 */
private static ASTNode createPolynomialFunctionAST(PolynomialFunction pf, double knot) {
    double[] coefficients = pf.getCoefficients();
    
    ASTNode sum = new ASTNode(ASTNode.Type.PLUS);
    
    // Coefficients start with the constant then x^1, x^2 and so on
    sum.addChild(new ASTNode(coefficients[0]));
    for (int i=1; i<coefficients.length; ++i) {
        sum.addChild(
                ASTNode.times(
                        new ASTNode(coefficients[i]),
                        ASTNode.pow(createTimeMinusOffsetAST(knot), i)));
    }
    return sum;
}
 
开发者ID:allyhume,项目名称:SBMLDataTools,代码行数:24,代码来源:PolynomialInterpolator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HandleCallback类代码示例发布时间:2022-05-22
下一篇:
Java VerificationResult类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap