Package org.sbml.jsbml

Examples of org.sbml.jsbml.AssignmentRule


              return rule;
            } else if (elementName.equals("assignmentRule")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfRules)
                && model.getLevel() > 1) {
              AssignmentRule rule = (AssignmentRule) newContextObject;
              model.addRule(rule);

              return rule;
            } else if (elementName.equals("parameterRule")
                && list.getSBaseListType().equals(ListOf.Type.listOfRules)
View Full Code Here


  }

  @Test
  public void test_Model_addRules() throws ParseException {
    Rule r1 = new AlgebraicRule(2, 4);
    AssignmentRule r2 = new AssignmentRule(2, 4);
    RateRule r3 = new RateRule(2, 4);
    r2.setVariable("r2");
    r3.setVariable("r3");
    r1.setMath(ASTNode.parseFormula("2"));
    r2.setMath(ASTNode.parseFormula("2"));
    r3.setMath(ASTNode.parseFormula("2"));
    M.addRule(r1);
    M.addRule(r2);
    M.addRule(r3);
    assertTrue(M.getNumRules() == 3);
View Full Code Here

  // TODO : API changes, setVariable function is not in the Rule Class.

  @Test
  public void test_Model_getRules() throws ParseException {
    Rule ar = new AlgebraicRule(2, 4);
    AssignmentRule scr = new AssignmentRule(2, 4);
    AssignmentRule cvr = new AssignmentRule(2, 4);
    AssignmentRule pr = new AssignmentRule(2, 4);
    scr.setVariable("r2");
    cvr.setVariable("r3");
    pr.setVariable("r4");
    ar.setFormula("x + 1");
    scr.setFormula("k * t/(1 + k)");
    cvr.setFormula("0.10 * t");
    pr.setFormula("k3/k2");
    M.addRule(ar);
    M.addRule(scr);
    M.addRule(cvr);
    M.addRule(pr);
    assertTrue(M.getNumRules() == 4);
    ar = M.getRule(0);
    scr = (AssignmentRule) M.getRule(1);
    cvr = (AssignmentRule) M.getRule(2);
    pr = (AssignmentRule) M.getRule(3);
    assertTrue(ar.getFormula().equals("x+1")); // .equals("x + 1")
    assertTrue(scr.getFormula().equals("k*t/(1+k)")); // .equals("k * t/(1 + k)"));
    assertTrue(cvr.getFormula().equals("0.1*t")); // .equals("0.10 * t"));
    assertTrue(pr.getFormula().equals("k3/k2"));
  }
 
View Full Code Here

      if (model.isSetListOfRules()) {
        for (int i = 0; i < model.getNumRules(); i++) {
          Rule rule = model.getRule(i);
          if (rule instanceof AssignmentRule) {
            AssignmentRule assignmentRule = (AssignmentRule) rule;
            setAssignmentRuleVariable(assignmentRule, model);
          } else if (rule instanceof RateRule) {
            RateRule rateRule = (RateRule) rule;
            setRateRuleVariable(rateRule, model);
          }
View Full Code Here

              return rule;
            } else if (elementName.equals("assignmentRule") // TODO : wrong, there are no assignmentRule element, only more specialize rule
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfRules)) {
              AssignmentRule rule = (AssignmentRule) newContextObject;
              model.addRule(rule);

              return rule;
            } else if (elementName.equals("reaction")
                && list.getSBaseListType().equals(
View Full Code Here

        if (sbase.getElementName().equals("species")) {
          xmlObject.setName("specie");
        } else if (sbase.getElementName().equals("speciesReference")) {
          xmlObject.setName("specieReference");
        } else if (sbase.getElementName().equals("assignementRule")) {
          AssignmentRule assignmentRule = (AssignmentRule) sbase;
          Variable variable = assignmentRule.getVariableInstance();

          if (variable instanceof Species) {
            xmlObject.setName("specieConcentrationRule");
          } else if (variable instanceof Compartment) {
            xmlObject.setName("compartmentVolumeRule");
View Full Code Here

        }
       
        for (int i = 0; i < model.getNumRules(); i++) {
          Rule rule = model.getRule(i);
          if (rule instanceof AssignmentRule) {
            AssignmentRule assignmentRule = (AssignmentRule) rule;
            if (assignmentRule.isSetVariable()
                && !assignmentRule.isSetVariableInstance()) {
              log4jLogger.warn("No Symbol matches the variableID of AssignmentRule.");
            }
            if (assignmentRule.isSetUnits()
                && !assignmentRule.isSetUnitsInstance()
                && assignmentRule.isParameter()) {
              log4jLogger.warn("No UnitDefinition matches the unitsID of AssignmentRule.");
            }
          } else if (rule instanceof RateRule) {
            RateRule rateRule = (RateRule) rule;
            if (rateRule.isSetVariable()
View Full Code Here

              return rule;
            } else if (elementName.equals("assignmentRule")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfRules)
                && model.getLevel() > 1) {
              AssignmentRule rule = (AssignmentRule) newContextObject;
              model.addRule(rule);

              return rule;
            } else if (elementName.equals("parameterRule")
                && list.getSBaseListType().equals(ListOf.Type.listOfRules)
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.AssignmentRule

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.