Package org.sbml.jsbml

Examples of org.sbml.jsbml.Event


  private Event E;

  @Before public void setUp() throws Exception
  {
    E = new  Event(2,4);
    if (E == null);
    {
    }
  }
View Full Code Here


  @Test public void test_Event_full() throws ParseException
  {
    ASTNode math1 = ASTNode.parseFormula("0");
    Trigger trigger = new  Trigger(2,4);
    ASTNode math = ASTNode.parseFormula("0");
    Event e = new  Event(2,4);
    EventAssignment ea = new  EventAssignment(2,4);
    ea.setVariable( "k");
    ea.setMath(math);
    trigger.setMath(math1);
    e.setTrigger(trigger);
    e.setId( "e1");
    e.setName( "Set k2 to zero when P1 <= t");
    e.addEventAssignment(ea);
    assertTrue( e.getNumEventAssignments() == 1 );
    assertTrue(e.getEventAssignment(0) == ea);
    math = null;
    e = null;
  }
View Full Code Here

  }

  @SuppressWarnings("deprecation")
@Test public void test_Event_setTimeUnits()
  {
    Event E1 = new  Event(2,1);
    String units =  "second";;
    E1.setTimeUnits(units);
    assertTrue(E1.getTimeUnits().equals(units));
    assertEquals( true, E1.isSetTimeUnits() );
    if (E1.getTimeUnits() == units);
    {
    }
    E1.setTimeUnits(E1.getTimeUnits());
    assertTrue(E1.getTimeUnits().equals(units));
    E1.setTimeUnits("");
    assertEquals( false, E1.isSetTimeUnits() );
    if (E1.getTimeUnits() != null);
    {
    }
    E1 = null;
  }
View Full Code Here

    }
  }

  @Test public void test_Event_setUseValuesFromTriggerTime()
  {
    Event object = new  Event(2,4);
    object.setUseValuesFromTriggerTime(false);
    assertTrue( object.getUseValuesFromTriggerTime() == false );
    object.setUseValuesFromTriggerTime(true);
    assertTrue( object.getUseValuesFromTriggerTime() == true );
    object = null;
  }
View Full Code Here

          setCompartmentUnits(compartment, model);
        }
      }
      if (model.isSetListOfEvents()) {
        for (int i = 0; i < model.getNumEvents(); i++) {
          Event event = model.getEvent(i);

          setEventTimeUnits(event, model);

          if (event.isSetListOfEventAssignments()) {

            for (int j = 0; j < event.getNumEventAssignments(); j++) {
              EventAssignment eventAssignment = event
                  .getEventAssignment(j);

              setEventAssignmentVariable(eventAssignment, model);
            }
          }
View Full Code Here

    assertTrue(rdClkKL.getListOfParameters().size() == 3);
    assertTrue(rdClkKL.getListOfParameters().get(2).getId().equals("parameter_0000009"));
    assertTrue(rdClkKL.getListOfParameters().get(2).getName().equals("tau2"));
    assertTrue(rdClkKL.getListOfParameters().get(2).getValue() == 10);
   
    Event event = model.getEvent(0);
   
    assertTrue(event.getMetaId().equals("metaid_0000015"));
    assertTrue(event.getNumEventAssignments() == 1);
    assertTrue(event.getEventAssignment(0).getVariable().equals("dClkF"));
   
    System.out.println("First Trigger = " + event.getTrigger().getFormula());
   
    assertTrue(event.getTrigger().getMathMLString().contains("<math"));
    assertTrue(!event.getTrigger().getMathMLString().contains("athML<apply"));
   
  }
View Full Code Here

    k1.addCVTerm(new CVTerm(CVTerm.Qualifier.BQB_IS, "test"));
   
    k1.setConstant(false);
    k2.setConstant(false);
   
    Event event = model.createEvent("test_event");
   
    Trigger trigger = event.createTrigger();
    trigger.setMath(ASTNode.geq(new ASTNode(ASTNode.Type.NAME_TIME),
        new ASTNode(10)));
   
    EventAssignment assignment1 = event.createEventAssignment();
    assignment1.setVariable(k1);
    assignment1.setMath(new ASTNode(34));
   
    EventAssignment assignment2 = event.createEventAssignment();
    assignment2.setVariable(k2);
    assignment2.setMath(new ASTNode(k1));
   
    new SBMLWriter().write(doc, System.out);
  }
View Full Code Here

    doc.addTreeNodeChangeListener(this);
    Model model = doc.createModel("event_model");
    Compartment c = model.createCompartment("compartment");
    model.createSpecies("s1", c);
    model.createSpecies("s2", c);
    Event ev = model.createEvent();
    Trigger trigger = ev.createTrigger(false, true, ASTNode.parseFormula("3 >= 2"));
    trigger.setMath(ASTNode.geq(new ASTNode(ASTNode.Type.NAME_TIME),
        new ASTNode(10)));
    ev.createPriority(ASTNode.parseFormula("25"));
    ev.createDelay(ASTNode.parseFormula("2"));
    ev.createEventAssignment("s1", ASTNode.parseFormula("s2"));
    System.out.println("==================================");
    new SBMLWriter().write(doc, System.out);
    System.out.println("\n==================================");
    doc.setLevelAndVersion(2, 4);
    System.out.println("==================================");
View Full Code Here

      math = ASTNode.parseFormula("0");
    } catch (ParseException e) {
      assertTrue(false);
    }

    Event e1 = new Event(2, 4);
    Event e2 = new Event(2, 4);
    Trigger t = new Trigger(2, 4);
    e1.setTrigger(t);
    e2.setTrigger(t); // TODO : Document the difference : Setting the same trigger object there in jsbml !!!
    e1.createEventAssignment("k1", math);
    e2.createEventAssignment("k2", math);
    M.addEvent(e1);
    M.addEvent(e2);
    assertTrue(M.getNumEvents() == 2);
    // assertTrue(!M.getEvent(0).equals(e1)); // the eventAssignement would be the same in jsbml
    // assertTrue(!M.getEvent(1).equals(e2));
View Full Code Here

    assertEquals(M.getConstraint(0), c);
  }

  @Test
  public void test_Model_createEvent() {
    Event e = M.createEvent();
    assertTrue(e != null);
    assertTrue(M.getNumEvents() == 1);
    assertEquals(M.getEvent(0), e);
  }
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Event

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.