Exemplo n.º 1
0
        public void test_UnitDefinition_ancestor_create()
        {
            Model          m  = new Model(2, 4);
            UnitDefinition ud = m.createUnitDefinition();
            ListOf         lo = m.getListOfUnitDefinitions();

            assertTrue(ud.getAncestorOfType(libsbml.SBML_MODEL) == m);
            assertTrue(ud.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(ud.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(ud.getAncestorOfType(libsbml.SBML_EVENT) == null);
            UnitDefinition obj = m.getUnitDefinition(0);

            assertTrue(obj.getAncestorOfType(libsbml.SBML_MODEL) == m);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == null);
        }
Exemplo n.º 2
0
        public void test_UnitDefinition_ancestor_add()
        {
            UnitDefinition ia = new UnitDefinition(2, 4);
            Model          m  = new Model(2, 4);

            ia.setId("u");
            ia.createUnit();
            m.addUnitDefinition(ia);
            ia = null;
            ListOf         lo  = m.getListOfUnitDefinitions();
            UnitDefinition obj = m.getUnitDefinition(0);

            assertTrue(obj.getAncestorOfType(libsbml.SBML_MODEL) == m);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null);
            assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == null);
        }
        public void test_UnitDefinition_parent_NULL()
        {
            SBMLDocument   d = new SBMLDocument();
            Model          m = d.createModel();
            UnitDefinition c = m.createUnitDefinition();
            Unit           u = c.createUnit();

            assertTrue(u.getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == c);
            UnitDefinition c1 = c.clone();

            d = null;
            assertTrue(c1.getAncestorOfType(libsbml.SBML_MODEL) == null);
            assertTrue(c1.getParentSBMLObject() == null);
            assertEquals(c1.getSBMLDocument(), null);
            assertTrue(c1.getUnit(0).getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == c1);
            assertTrue(c1.getUnit(0).getParentSBMLObject() != null);
            assertEquals(c1.getUnit(0).getSBMLDocument(), null);
            c1 = null;
        }