本文整理汇总了Java中org.sbml.jsbml.ASTNode.isName方法的典型用法代码示例。如果您正苦于以下问题:Java ASTNode.isName方法的具体用法?Java ASTNode.isName怎么用?Java ASTNode.isName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sbml.jsbml.ASTNode
的用法示例。
在下文中一共展示了ASTNode.isName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: 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);
}
}
}
示例3: 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);
}
}
}
示例4: 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);
}
}
}
示例5: 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);
}
}
}
示例6: setupConstraints
import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
/**
* puts constraint-related information into data structures
*/
protected void setupConstraints()
{
// loop through all constraints to find out which variables affect which
// constraints
// this is stored in a hashmap, as is whether the variable is in a
// constraint
for (Constraint constraint : model.getListOfConstraints())
{
constraint.setMath(inlineFormula(constraint.getMath()));
for (ASTNode constraintNode : constraint.getMath().getListOfNodes())
{
if (constraintNode.isName())
{
String nodeName = constraintNode.getName();
variableToAffectedConstraintSetMap.put(nodeName, new HashSet<ASTNode>());
variableToAffectedConstraintSetMap.get(nodeName).add(constraint.getMath());
variableToIsInConstraintMap.put(nodeName, true);
}
}
}
}
示例7: getSymbols
import org.sbml.jsbml.ASTNode; //导入方法依赖的package包/类
private static void getSymbols(ASTNode math, Set<String> symbols) {
if (math.isName()) {
symbols.add(math.getName());
}
math.getChildren().forEach(c -> getSymbols(c, symbols));
}
示例8: 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;
}