use of org.vcell.model.bngl.ASTSpeciesPattern in project vcell by virtualcell.
the class RbmUtils method parseSpeciesPattern.
public static SpeciesPattern parseSpeciesPattern(String originalInputString, Model model) throws ParseException {
String inputString = new String(originalInputString);
try {
if (inputString.startsWith("@") && inputString.contains(":")) {
// throw new ParseException("RbmUtils: Unable to parse SpeciesPattern with compartment information.");
// clean up the compartment information and parse the pure sp expression
inputString = inputString.substring(inputString.lastIndexOf(":") + 1);
}
BNGLParser parser = new BNGLParser(new StringReader(inputString));
ASTSpeciesPattern astSpeciesPattern = parser.SpeciesPattern();
BnglObjectConstructionVisitor constructionVisitor = new BnglObjectConstructionVisitor(model, null, true);
SpeciesPattern speciesPattern = (SpeciesPattern) astSpeciesPattern.jjtAccept(constructionVisitor, null);
return speciesPattern;
} catch (Throwable ex) {
ex.printStackTrace();
throw new ParseException(ex.getMessage());
}
}
Aggregations