/** * Gets the value of this node as a single character. This function should * be called only when ASTNode.getType() is one of PLUS, MINUS, TIMES, * DIVIDE or POWER. * * @return the value of this ASTNode as a single character * @throws IllegalArgumentException * if the type of the node is not one of PLUS, MINUS, TIMES, * DIVIDE or POWER. */ public char getCharacter() { if (isOperator()) { switch (type) { case PLUS: return '+'; case MINUS: return '-'; case TIMES: return '*'; case DIVIDE: return '/'; case POWER: return '^'; default: break; } } throw new IllegalArgumentException(resourceBundle.getString("ASTNode.compile4")); }
@Override public boolean check(ValidationContext ctx, ASTNode node) { // In operators... if (node.isOperator() || set.contains(node.getType())) { // all children must be numbers for (ASTNode n : node.getChildren()) { if (ValidationTools.getDataType(n) != ValidationTools.DT_NUMBER) { return false; } } } return true; }
/** * Gets the name of this node. This method may be called on nodes that are * not operators ({@code isOperator() == false}) or numbers ({@code isNumber() == false}). * * @return the name of this node. * @throws IllegalArgumentException * if the method is called on nodes that are operators or * numbers. */ public String getName() { if (!isOperator() && !isNumber()) { return (variable == null) ? name : variable.getId(); } if (!isInvalidSBMLAllowed()) { throw new IllegalArgumentException(resourceBundle.getString("ASTNode.getName")); } return name; }
if ((astNode.isFunction() || astNode.isOperator() || astNode.isRelational() || astNode.isLogical()) && !elementName.equals("apply") && !elementName.equals("piecewise") && !elementName.equals("lamdba") && !astNode.getType().equals(ASTNode.Type.LAMBDA)
if (isInteger()) { hashCode += prime * getInteger(); } else if (!isNumber() && !isOperator() && (isSetName() || (variable != null))) { hashCode += prime * getName().hashCode(); } else if (isRational()) {
body.isNumber() || body.isFunction() || body.isOperator() || body.getType() == Type.CONSTANT_PI || body.getType() == Type.CONSTANT_E;
if (node.isNumber() || node.isOperator() || node.isConstant()) { return DT_NUMBER;