/** * * @param math * @return * @deprecated since SBML Level 3 this should not be used anymore. */ @Deprecated public StoichiometryMath createStoichiometryMath(ASTNode math) { StoichiometryMath sm = new StoichiometryMath(getLevel(), getVersion()); sm.setMath(math); setStoichiometryMath(sm); return sm; }
/** * * @return * @deprecated */ @Deprecated public boolean unsetStoichiometryMath() { if (stoichiometryMath != null) { StoichiometryMath oldStoichiometryMath = stoichiometryMath; stoichiometryMath = null; oldStoichiometryMath.fireNodeRemovedEvent(); return true; } return false; }
@Override public String getDerivedUnits() { if (isSetStoichiometryMath()) { return stoichiometryMath.getDerivedUnits(); } return Unit.Kind.DIMENSIONLESS.toString(); }
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; } };
@Override public String printSpeciesReference() { StringBuilder sb = new StringBuilder(); if (isSetStoichiometry() && (getStoichiometry() != 1d)) { sb.append(StringTools.toString(getStoichiometry())); sb.append(' '); } else if (isSetStoichiometryMath()) { sb.append(getStoichiometryMath().getMath().toFormula()); sb.append(' '); } sb.append(super.printSpeciesReference()); return sb.toString(); }
@Override @Deprecated public StoichiometryMath clone() { return new StoichiometryMath(this); }
@Override public boolean containsUndeclaredUnits() { if (isSetStoichiometryMath()) { return getStoichiometryMath().containsUndeclaredUnits(); } return isSetStoichiometry() ? false : true; }
@Override public UnitDefinition getDerivedUnitDefinition() { if (isSetStoichiometryMath()) { return stoichiometryMath.getDerivedUnitDefinition(); } UnitDefinition ud = new UnitDefinition(getLevel(), getVersion()); ud.addUnit(Unit.Kind.DIMENSIONLESS); return ud; }
/** * Creates a SpeciesReference instance from a given SpeciesReference. * * @param speciesReference */ @SuppressWarnings("deprecation") public SpeciesReference(SpeciesReference speciesReference) { super(speciesReference); if (speciesReference.isSetStoichiometryMath()) { setStoichiometryMath(speciesReference.getStoichiometryMath() .clone()); } if (speciesReference.isSetStoichiometry()) { setStoichiometry(new Double(speciesReference.getStoichiometry())); } else { stoichiometry = speciesReference.stoichiometry == null ? null : new Double(speciesReference.stoichiometry); } if (speciesReference.isSetConstant()) { setConstant(new Boolean(speciesReference.isConstant())); } else { constant = speciesReference.constant == null ? null : new Boolean(speciesReference.constant); } if (speciesReference.isSetDenominator) { setDenominator(new Integer(speciesReference.getDenominator())); } else { denominator = speciesReference.denominator == null ? null : new Integer(speciesReference.denominator); } }
reactionEqn.append(reactant.getStoichiometryMath().getMath().toASTNode2() .compile((ASTNode2Compiler) this)); } else if (reactant.getStoichiometry() != 1d) { reactionEqn.append(product.getStoichiometryMath().getMath().toASTNode2() .compile((ASTNode2Compiler) this)); } else if (product.getStoichiometry() != 1d) {