/** * Returns {@code true} if this node is a name or refers to a * {@link FunctionDefinition}. * * @return {@code true} if this {@link ASTNode} is a user-defined variable name in SBML L1, * L2 (MathML) or the special symbols time or Avogadro. * @see #isName() */ public boolean isString() { return isName() || (type == Type.FUNCTION); }
@Override public boolean accepts( Object o) { return ((ASTNode) o).isName(); }
@Override public boolean check(ValidationContext ctx, ASTNode node) { // TODO - ci is only allowed since L2V5/L3 // definitionURL only on some elements if (node.isSetDefinitionURL() && !(node.isSemantics() || node.isName() || node.getType() == ASTNode.Type.FUNCTION_DELAY || node.getType() == ASTNode.Type.FUNCTION_RATE_OF)) { return false; } return true; } };
private boolean checkStoichiometryMath(Model m, SpeciesReference ref, Set<String> definedSpecies) { if (ref.isSetStoichiometryMath() && ref.getStoichiometryMath().isSetMath()) { Queue<ASTNode> queue = new LinkedList<ASTNode>(); queue.offer(ref.getStoichiometryMath().getMath()); while (!queue.isEmpty()) { ASTNode node = queue.poll(); if (node.isName()) { String name = (node.getName() != null) ? node.getName() : ""; if (m.getSpecies(name) != null && !definedSpecies.contains(name)) { return false; } } queue.addAll(node.getListOfNodes()); } } return true; } };
else if (isName())
ASTNode node = toCheck.poll(); if (node.isName()) { if (definedLater.contains(node.getName())) { return false;
/** * Compiles a function with one argument and where we don't want to put the argument * between brackets if it is a number or an id. * * @param name the name of the function, can also be just a sign, like not ('!') or '<='. * @param node the single argument to the function * @return a new {@link ASTNodeValue} that contain the String representation of the function. * @throws SBMLException if an error is detected while going through the {@link ASTNode} */ protected ASTNodeValue functionNotAlwaysBrackets(String name, ASTNode node) throws SBMLException { if (node.isName() || node.isNumber()) { return new ASTNodeValue(concat(name, node.compile(this)).toString(), this); } return new ASTNodeValue(concat(name, brackets(node.compile(this))).toString(), this); }
/** * @param node * @param value */ private void updateASTNodeName(ASTNode node, int value) { if (node.isVector()) { for (int i = 0; i < node.getChildCount(); ++i) { ASTNode child = node.getChild(i); updateASTNodeName(child, value); } } else if (node.isName()) { node.setName("_" + String.valueOf(value) + node.getName()); } else { node.setName("unknown"); } }
@Override public boolean check(ValidationContext ctx, ASTNode node) { if (node.getParentSBMLObject() == null) { // something is wrong with the ASTNode return true; } Model m = node.getParentSBMLObject().getModel(); if (m != null && node.isName()) { Compartment c = m.getCompartment(node.getName()); if (c != null && c.getSpatialDimensions() == 0) { return false; } } return true; }
if (astNode.isName() || astNode.isFunction()) { astNode.setName(characters.trim()); } else if (astNode.isInteger()) {
if(vector.isName()) { return vector.getName();
/** * @param node * @param value */ private void updateASTNodeName(ASTNode node, String value) { if (node.isVector()) { for (int i = 0; i < node.getChildCount(); ++i) { ASTNode child = node.getChild(i); updateASTNodeName(child, value); } } else if (node.isName()) { String appendName = node.getName(); while(model.findNamedSBase(value + appendName) != null) { appendName = "_" + appendName; } node.setName(value + appendName); } else { node.setName("unknown"); } }
else if (node.isName())
sbase.unsetExtension(ArraysConstants.shortLabel); if (sbase.isSetId() && vector != null && vector.isName()) { sbase.setId(vector.getName());
if (body.isName() && body.getNumChildren() == 0)
String name = null; if (nameAST.isName()) { name = nameAST.getName();
if (node.isName()) {