Package org.sbml.jsbml

Examples of org.sbml.jsbml.FunctionDefinition


    assertEquals(M.getEvent(-2), null);
  }

  @Test
  public void test_Model_add_get_FunctionDefinitions() throws ParseException {
    FunctionDefinition fd1 = new FunctionDefinition(2, 4);
    FunctionDefinition fd2 = new FunctionDefinition(2, 4);
    fd1.setId("fd1");
    fd2.setId("fd2");
    fd1.setMath(ASTNode.parseFormula("lambda(2)"));
    fd2.setMath(ASTNode.parseFormula("lambda(x, x+2)"));
    M.addFunctionDefinition(fd1);
    M.addFunctionDefinition(fd2);
    assertTrue(M.getNumFunctionDefinitions() == 2);
    // assertTrue(!M.getFunctionDefinition(0).equals(fd1)); // would be the same in jsbml
    // assertTrue(!M.getFunctionDefinition(1).equals(fd2));
View Full Code Here


    assertTrue(M.createEventAssignment() == null);
  }

  @Test
  public void test_Model_createFunctionDefinition() {
    FunctionDefinition fd = M.createFunctionDefinition();
    assertTrue(fd != null);
    assertTrue(M.getNumFunctionDefinitions() == 1);
    assertEquals(M.getFunctionDefinition(0), fd);
  }
View Full Code Here

    assertEquals(M.getEvent("e3"), null);
  }

  @Test
  public void test_Model_getFunctionDefinitionById() throws ParseException {
    FunctionDefinition fd1 = new FunctionDefinition(2, 4);
    FunctionDefinition fd2 = new FunctionDefinition(2, 4);
    fd1.setId("sin");
    fd2.setId("cos");
    fd1.setMath(ASTNode.parseFormula("lambda(2)"));
    fd2.setMath(ASTNode.parseFormula("lambda(2)"));
    M.addFunctionDefinition(fd1);
    M.addFunctionDefinition(fd2);
    assertTrue(M.getNumFunctionDefinitions() == 2);
    //assertTrue(!M.getFunctionDefinition("sin").equals(fd1));
    // assertTrue(!M.getFunctionDefinition("cos").equals(fd2));
View Full Code Here

    o3 = null;
  }

  @Test
  public void test_Model_removeFunctionDefinition() {
    FunctionDefinition o1, o2, o3;
    o1 = M.createFunctionDefinition();
    o2 = M.createFunctionDefinition();
    o3 = M.createFunctionDefinition();
    o3.setId("test");
    assertTrue(M.removeFunctionDefinition(0).equals(o1));
View Full Code Here

  public static void main(String[] args) throws ParseException, SBMLException, XMLStreamException {
   
    SBMLDocument document = new SBMLDocument(2,4);
    Model model = document.createModel("testFD");
   
    FunctionDefinition location = model.createFunctionDefinition("location");
   
    location.setMath(ASTNode.parseFormula("lambda(x,0)"));
   
    model.createCompartment("cell");
    model.createParameter("P1");
   
    AssignmentRule rule = model.createAssignmentRule();
View Full Code Here

            Model model = (Model) list.getParentSBMLObject();
            if (elementName.equals("functionDefinition")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfFunctionDefinitions)
                && model.getLevel() > 1) {
              FunctionDefinition functionDefinition = (FunctionDefinition) newContextObject;
              model.addFunctionDefinition(functionDefinition);

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

   
    /*
     * Function Definitions
     */
    logger.debug("==== FunctionDefinitions ====");
    FunctionDefinition f1 = model.createFunctionDefinition("f1");
    model.removeFunctionDefinition(f1.getId());
   
    try {
      SBMLWriter.write(doc, System.out, ' ', (short) 2);
    } catch (Exception exc) {
      exc.printStackTrace();
View Full Code Here

   
    /*
     * Function Definitions
     */
    logger.debug("==== FunctionDefinitions ====");
    FunctionDefinition f1 = model.createFunctionDefinition("f1");
    model.removeFunctionDefinition(f1.getId());
   
    try {
      SBMLWriter.write(doc, System.out, ' ', (short) 2);
    } catch (Exception exc) {
      exc.printStackTrace();
View Full Code Here

        //
        // FunctionDefinition
        //
        for (String functionDefinitionId : relatedFunctionsIdSet) {
            FunctionDefinition func = model.getFunctionDefinition(functionDefinitionId);
            getRelatedFunctionsId(relatedFunctionsIdSet, allFunctionsIdSet, func.getMath());
        }
        for (String functionDefinitionId : relatedFunctionsIdSet) {
            subModel.addFunctionDefinition(model.getFunctionDefinition(functionDefinitionId).clone());
        }
View Full Code Here

            Model model = (Model) list.getParentSBMLObject();
            if (elementName.equals("functionDefinition")
                && list.getSBaseListType().equals(
                    ListOf.Type.listOfFunctionDefinitions)
                && model.getLevel() > 1) {
              FunctionDefinition functionDefinition = (FunctionDefinition) newContextObject;
              model.addFunctionDefinition(functionDefinition);

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

TOP

Related Classes of org.sbml.jsbml.FunctionDefinition

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.