Example #1
0
        public void test_EventAssignment_ancestor_create()
        {
            Event           e  = new Event(2, 4);
            EventAssignment ea = e.createEventAssignment();
            ListOf          lo = e.getListOfEventAssignments();

            assertTrue(ea.getAncestorOfType(libsbml.SBML_EVENT) == e);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null);
            EventAssignment obj = e.getEventAssignment(0);

            assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == e);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null);
        }
Example #2
0
        public void test_EventAssignment_ancestor_add()
        {
            Event           e  = new Event(2, 4);
            EventAssignment ea = new EventAssignment(2, 4);

            ea.setVariable("c");
            ea.setMath(libsbml.parseFormula("K+L"));
            e.addEventAssignment(ea);
            ea = null;
            ListOf          lo  = e.getListOfEventAssignments();
            EventAssignment obj = e.getEventAssignment(0);

            assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == e);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null);
        }
        public void test_Event_parent_NULL()
        {
            SBMLDocument    d  = new SBMLDocument(2, 4);
            Model           m  = d.createModel();
            Event           c  = m.createEvent();
            EventAssignment ea = c.createEventAssignment();
            Trigger         t  = new Trigger(2, 4);

            t.setMath(new ASTNode());
            Delay dy = new Delay(2, 4);

            dy.setMath(new ASTNode());
            c.setTrigger(t);
            c.setDelay(dy);
            assertTrue(c.getAncestorOfType(libsbml.SBML_MODEL) == m);
            assertTrue(c.getTrigger().getParentSBMLObject() == c);
            assertEquals(c.getDelay().getSBMLDocument(), d);
            assertTrue(ea.getAncestorOfType(libsbml.SBML_EVENT) == c);
            Event c1 = c.clone();

            d = null;
            assertTrue(c1.getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getParentSBMLObject() == null);
            assertEquals(c1.getSBMLDocument(), null);
            assertTrue(c1.getEventAssignment(0).getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getEventAssignment(0).getAncestorOfType(libsbml.SBML_EVENT) == c1);
            assertTrue(c1.getEventAssignment(0).getParentSBMLObject() != null);
            assertEquals(c1.getEventAssignment(0).getSBMLDocument(), null);
            assertTrue(c1.getTrigger().getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getTrigger().getAncestorOfType(libsbml.SBML_EVENT) == c1);
            assertTrue(c1.getTrigger().getParentSBMLObject() != null);
            assertEquals(c1.getTrigger().getSBMLDocument(), null);
            assertTrue(c1.getDelay().getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getDelay().getAncestorOfType(libsbml.SBML_EVENT) == c1);
            assertTrue(c1.getDelay().getParentSBMLObject() != null);
            assertEquals(c1.getDelay().getSBMLDocument(), null);
            c1 = null;
        }