/** * @param astNode */ private void compileReal_e(ASTNode astNode) { try { writer.writeCharacters(indent); writer.writeStartElement(ASTNode.URI_MATHML_DEFINITION, "cn"); writer.writeAttribute("type", "e-notation"); if (astNode.isSetUnits()) { writer.writeAttribute("sbml:units", astNode.getUnits()); } writer.writeCharacters(realFormat.format(astNode.getMantissa())); writer.writeCharacters(" "); writer.writeEmptyElement(ASTNode.URI_MATHML_DEFINITION, "sep"); writer.writeCharacters(" "); writer.writeCharacters(realFormat.format(astNode.getExponent())); writer.writeCharacters(" "); writer.writeEndElement(); writer.writeCharacters("\n"); } catch (XMLStreamException e) { e.printStackTrace(); } }
return mantissa; return Double.parseDouble(mantissa + "E" + getExponent());
buffer.append(" (").append(getMantissa()).append("e").append(getExponent());
&& ast.getExponent() == getExponent(); } else if (isReal() && ast.isReal()) { equal &= Double.isNaN(getReal()) ? Double.isNaN(ast.getReal()) : ast.getReal() == getReal();
child.setValue(-child.getMantissa(), child.getExponent()); minus.addChild(child);
compiled.setValue(-value.getNumerator(), value.getDenominator()); } else if (compiled.getType().equals(Type.REAL_E)) { compiled.setValue(-value.getMantissa(), value.getExponent()); } else { compiled.setValue(-value.getReal());
/** * @param value */ private void uMinusRecursive(ASTNode value) { for (int i = 0; i < value.getChildCount(); i++) { value.getChild(i).compile(this); ASTNode child = getNode(); if (child.isVector()) { uMinusRecursive(value.getChild(i)); } else if (useId) { value.replaceChild(i, ASTNode.uMinus(child)); } else if (child.isNumber()) { if (child.isInteger()) { value.getChild(i).setValue(-child.getInteger()); } else if (child.isRational()) { value.getChild(i).setValue(-child.getNumerator(), child.getDenominator()); } else if (child.getType().equals(Type.REAL_E)) { value.getChild(i).setValue(-child.getMantissa(), child.getExponent()); } else { value.getChild(i).setValue(-child.getReal()); } } else { throw new SBMLException(); } } }
break; case REAL_E: value = compiler.compile(getMantissa(), getExponent(), isSetUnits() ? getUnits() : null); break;