Browse Source

Re-factor SBML-to-PRISM translator.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@5405 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 14 years ago
parent
commit
f369c6599a
  1. 12
      prism/src/prism/Reactions2Prism.java
  2. 18
      prism/src/prism/SBML2Prism.java

12
prism/src/prism/Reactions2Prism.java

@ -56,12 +56,15 @@ public class Reactions2Prism
protected ArrayList<Parameter> parameterList;
protected ArrayList<Reaction> reactionList;
// Config
/** Maximum amount of each species (unless some initial amound is higher). */
protected int maxAmount = 100;
// Optional PRISM code header/footer
protected String prismCodeHeader;
protected String prismCodeFooter;
protected int maxAmount;
// Constructors
public Reactions2Prism()
@ -74,6 +77,11 @@ public class Reactions2Prism
this.mainLog = mainLog;
}
public void setMaxAmount(int maxAmount)
{
this.maxAmount = maxAmount;
}
/**
* Print the currently loaded reaction set model (for testing purposes).
*/

18
prism/src/prism/SBML2Prism.java

@ -62,7 +62,13 @@ public class SBML2Prism extends Reactions2Prism implements EntityResolver
System.exit(1);
}
SBML2Prism sbml2prism = new SBML2Prism(errLog);
sbml2prism.translate(new File(args[0]), (args.length > 1) ? args[1] : "100");
try {
if (args.length > 1)
sbml2prism.setMaxAmount(Integer.parseInt(args[1]));
} catch (NumberFormatException e) {
throw new PrismException("Invalid max amount \"" + args[1] + "\"");
}
sbml2prism.translate(new File(args[0]));
} catch (PrismException e) {
errLog.println("Error: " + e.getMessage() + ".");
}
@ -81,16 +87,10 @@ public class SBML2Prism extends Reactions2Prism implements EntityResolver
}
/**
* Main method: load SBML file, process and sent resulting PRISM file to stdout
* Main method: load SBML file, process and send resulting PRISM file to stdout
*/
public void translate(File f, String maxAmount) throws PrismException
public void translate(File f) throws PrismException
{
// translate
try {
this.maxAmount = Integer.parseInt(maxAmount);
} catch (NumberFormatException e) {
throw new PrismException("Invalid max amount \"" + maxAmount + "\"");
}
// Read in SBML
Document doc = parseSBML(f);
checkSBMLVersion(doc);

Loading…
Cancel
Save