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


Java ASTNode类代码示例

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


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


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