Package org.sbml.jsbml

Examples of org.sbml.jsbml.FunctionDefinition


   
    /*
     * 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

    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.getFunctionDefinitionCount() == 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.getFunctionDefinitionCount() == 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.getFunctionDefinitionCount() == 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

   
    ASTNode astNode = (ASTNode) contextObject;
   
    // System.out.println("MathMLStaxParser : processCharactersOf : context type : " + astNode.getType());

    FunctionDefinition functionDef = null;
   
    try {
      functionDef = astNode.getParentSBMLObject().getModel().getFunctionDefinition(characters.trim());
    } catch(NullPointerException e) {
     
View Full Code Here

  public MathMLTest() {
    int level = 3;
    int version = 1;
    SBMLDocument doc = new SBMLDocument(level, 1);
    Model m = doc.createModel("id");
    FunctionDefinition fd = m.createFunctionDefinition("fd");
    ASTNode math = new ASTNode(Type.LAMBDA, fd);
    math.addChild(new ASTNode("x", fd));
    ASTNode pieces = ASTNode.piecewise(new ASTNode(3, fd), ASTNode.lt("x",
        ASTNode.abs(Double.NEGATIVE_INFINITY, fd)), ASTNode.times(
        new ASTNode(5.3, fd), ASTNode.log(new ASTNode(8, fd))));
    pieces = ASTNode.times(pieces, ASTNode.root(new ASTNode(2, fd),
        new ASTNode(16, fd)));
    math.addChild(pieces);
    fd.setMath(math);
    System.out.println(math.toMathML());
   
    Species species = m.createSpecies("spec");
    Reaction r = m.createReaction("r");
    r.addReactant(new SpeciesReference(species));
View Full Code Here

  /**
   * Test method for {@link org.sbml.jsbml.Model#removeFunctionDefinition(java.lang.String)}.
   */
  @Test
  public void testRemoveFunctionDefinitionString() {
    FunctionDefinition r = modelL3.createFunctionDefinition("fd1");
    assertTrue(modelL3.getFunctionDefinition(r.getId()) != null);

    modelL3.removeFunctionDefinition(r.getId());
    assertTrue(modelL3.getFunctionDefinition(r.getId()) == null);
  }
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.