Package org.sbml.jsbml.ext.fbc

Examples of org.sbml.jsbml.ext.fbc.FBCModelPlugin


  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();
View Full Code Here


        testDocument = new SBMLReader().readSBMLFromFile(fileName);
        System.out.printf("Reading done\n");
        System.out.println(Calendar.getInstance().getTime());
        afterRead = Calendar.getInstance().getTimeInMillis();

        FBCModelPlugin fbcModel = (FBCModelPlugin) testDocument.getModel().getExtension(FBCConstants.namespaceURI);

        if (fbcModel != null)
        {
          System.out.println("nb fluxBounds found: " + fbcModel.getListOfFluxBounds().size());
          System.out.println("nb objectives found: " + fbcModel.getListOfObjectives().size());
          System.out.println("nb fluxObjectives found: " + fbcModel.getObjective(0).getListOfFluxObjectives().size());
          System.out.println("Active objective: " + fbcModel.getActiveObjective());
          System.out.println("Active objective: " + fbcModel.getListOfObjectives().getActiveObjective());
        }
        else
        {
          System.out.println("!!!!!!!!!! not FBC model plugin defined !!!!!!!!!!!!");
        }
View Full Code Here

  @Override
  public SBasePlugin createPluginFor(SBase sbase) {

    if (sbase != null) {
      if (sbase instanceof Model) {
        return new FBCModelPlugin((Model) sbase);
      } else if (sbase instanceof Species) {
        return new FBCSpeciesPlugin((Species) sbase);
      }
    }
    return null;
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.ext.fbc.FBCModelPlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.