public Object processStartElement(String elementName, String uri, String prefix,
boolean hasAttributes, boolean hasNamespaces, Object contextObject)
{
if (contextObject instanceof Model) {
Model model = (Model) contextObject;
FBCModelPlugin fbcModel = null;
if (model.getExtension(FBCConstants.namespaceURI) != null) {
fbcModel = (FBCModelPlugin) model.getExtension(FBCConstants.namespaceURI);
} else {
fbcModel = new FBCModelPlugin(model);
model.addExtension(FBCConstants.namespaceURI, fbcModel);
}
if (elementName.equals(FBCList.listOfFluxBounds.name())) {
ListOf<FluxBound> listOfFluxBounds = fbcModel.getListOfFluxBounds();
groupList = FBCList.listOfFluxBounds;
return listOfFluxBounds;
}
else if (elementName.equals(FBCList.listOfObjectives.name())) {
ListOf<Objective> listOfObjectives = fbcModel.getListOfObjectives();
groupList = FBCList.listOfObjectives;
return listOfObjectives;
}
} else if (contextObject instanceof Objective) {
Objective objective = (Objective) contextObject;
if (elementName.equals("listOfFluxObjectives") || elementName.equals("listOfFluxes")) {
// listOfFluxes was the first name of listOfFluxObjectives in the preliminary specifications
ListOf<FluxObjective> listOfFluxObjectives = objective.getListOfFluxObjectives();
groupList = FBCList.listOfFluxObjectives;
return listOfFluxObjectives;
}
}
else if (contextObject instanceof ListOf<?>) {
ListOf<SBase> listOf = (ListOf<SBase>) contextObject;
if (elementName.equals("fluxBound")
&& groupList.equals(FBCList.listOfFluxBounds)) {
Model model = (Model) listOf.getParentSBMLObject();
FBCModelPlugin extendeModel = (FBCModelPlugin) model.getExtension(FBCConstants.namespaceURI);
FluxBound fluxBound = new FluxBound();
extendeModel.addFluxBound(fluxBound);
return fluxBound;
} else if (elementName.equals("objective")
&& groupList.equals(FBCList.listOfObjectives)) {
Model model = (Model) listOf.getParentSBMLObject();
FBCModelPlugin extendeModel = (FBCModelPlugin) model.getExtension(FBCConstants.namespaceURI);
Objective objective = new Objective();
extendeModel.addObjective(objective);
return objective;
} else if (elementName.equals("fluxObjective")
&& groupList.equals(FBCList.listOfFluxObjectives)) {
Objective objective = (Objective) listOf.getParentSBMLObject();