Package org.sbml.jsbml

Examples of org.sbml.jsbml.FunctionDefinition


      System.out.printf("[OUT]:\t%s\n", testNode.toFormula());
      System.out.printf("[LTX]:\t%s\n", testNode.toLaTeX());

//      AssignmentRule as = new AssignmentRule(2, 4);
      Model m = new Model(2, 4);
      FunctionDefinition fd = new FunctionDefinition("f", 2, 4);
      m.addFunctionDefinition(fd);
      //as.setMath(ASTNode.parseFormula("f(a, b, c, d)"));
      //m.addRule(as);
      //System.out.println(as.getMath().toString());
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.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

   
    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) {
      // TODO : this does not work when we do not set the model object when reading a mathML XML String by it's own.
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

      System.out.printf("[OUT]:\t%s\n", testNode.toFormula());
      System.out.printf("[LTX]:\t%s\n", testNode.toLaTeX());

//      AssignmentRule as = new AssignmentRule(2, 4);
      Model m = new Model(2, 4);
      FunctionDefinition fd = new FunctionDefinition("f", 2, 4);
      m.addFunctionDefinition(fd);
      //as.setMath(ASTNode.parseFormula("f(a, b, c, d)"));
      //m.addRule(as);
      //System.out.println(as.getMath().toString());
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

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.