Exemplo n.º 1
0
        public void test_Compartment_setVolume1()
        {
            int i = C.setVolume(2.0);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(C.getVolume() == 2.0);
            assertEquals(true, C.isSetVolume());
            i = C.unsetVolume();
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(C.getVolume() == 1.0);
            assertEquals(true, C.isSetVolume());
        }
Exemplo n.º 2
0
        public void test_L3_Compartment_createWithNS()
        {
            XMLNamespaces xmlns = new  XMLNamespaces();

            xmlns.add("http://www.sbml.org", "testsbml");
            SBMLNamespaces sbmlns = new  SBMLNamespaces(3, 1);

            sbmlns.addNamespaces(xmlns);
            Compartment c = new  Compartment(sbmlns);

            assertTrue(c.getTypeCode() == libsbml.SBML_COMPARTMENT);
            assertTrue(c.getMetaId() == "");
            assertTrue(c.getNotes() == null);
            assertTrue(c.getAnnotation() == null);
            assertTrue(c.getLevel() == 3);
            assertTrue(c.getVersion() == 1);
            assertTrue(c.getNamespaces() != null);
            assertTrue(c.getNamespaces().getLength() == 2);
            assertTrue(c.getId() == "");
            assertTrue(c.getName() == "");
            assertTrue(c.getUnits() == "");
            assertTrue(c.getOutside() == "");
            assertEquals(true, isnan(c.getSpatialDimensionsAsDouble()));
            assertEquals(true, isnan(c.getVolume()));
            assertTrue(c.getConstant() == true);
            assertEquals(false, c.isSetId());
            assertEquals(false, c.isSetSpatialDimensions());
            assertEquals(false, c.isSetName());
            assertEquals(false, c.isSetSize());
            assertEquals(false, c.isSetVolume());
            assertEquals(false, c.isSetUnits());
            assertEquals(false, c.isSetOutside());
            assertEquals(false, c.isSetConstant());
            c = null;
        }
Exemplo n.º 3
0
 public void test_Compartment_create()
 {
     assertTrue(C.getTypeCode() == libsbml.SBML_COMPARTMENT);
     assertTrue(C.getMetaId() == "");
     assertTrue(C.getNotes() == null);
     assertTrue(C.getAnnotation() == null);
     assertTrue(C.getId() == "");
     assertTrue(C.getName() == "");
     assertTrue(C.getUnits() == "");
     assertTrue(C.getOutside() == "");
     assertTrue(C.getSpatialDimensions() == 3);
     assertTrue(C.getVolume() == 1.0);
     assertTrue(C.getConstant() == true);
     assertEquals(false, C.isSetId());
     assertEquals(false, C.isSetName());
     assertEquals(false, C.isSetSize());
     assertEquals(false, C.isSetVolume());
     assertEquals(false, C.isSetUnits());
     assertEquals(false, C.isSetOutside());
 }
Exemplo n.º 4
0
        public void test_Compartment_setVolume2()
        {
            Compartment c = new  Compartment(2, 2);
            int         i = c.setVolume(4);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(c.getVolume() == 4.0);
            assertEquals(true, c.isSetVolume());
            i = c.unsetVolume();
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertEquals(false, c.isSetVolume());
            c = null;
        }
Exemplo n.º 5
0
        public void test_Compartment_initDefaults()
        {
            Compartment c = new  Compartment(2, 4);

            c.setId("A");
            c.initDefaults();
            assertTrue(("A" == c.getId()));
            assertTrue(c.getName() == "");
            assertTrue(c.getUnits() == "");
            assertTrue(c.getOutside() == "");
            assertTrue(c.getSpatialDimensions() == 3);
            assertTrue(c.getVolume() == 1.0);
            assertTrue(c.getConstant() == true);
            assertEquals(true, c.isSetId());
            assertEquals(false, c.isSetName());
            assertEquals(false, c.isSetSize());
            assertEquals(false, c.isSetVolume());
            assertEquals(false, c.isSetUnits());
            assertEquals(false, c.isSetOutside());
            assertEquals(true, c.isSetSpatialDimensions());
            assertEquals(true, c.isSetConstant());
            c = null;
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Creates a Volume Parameter for a MoBi Container.
        /// </summary>
        private IEntity CreateVolumeParameter(Compartment compartment)
        {
            var volume = 1.0;

            if (compartment.isSetVolume())
            {
                volume = compartment.getVolume();
            }
            else if (compartment.isSetSize())
            {
                volume = compartment.getSize();
            }

            var      unit      = compartment.getUnits();
            var      baseValue = _unitDefinitionImporter.ToMobiBaseUnit(unit, volume);
            IFormula formula   = _formulaFactory.ConstantFormula(baseValue.value, baseValue.dimension);

            var volumeParameter = _objectBaseFactory.Create <IParameter>()
                                  .WithName(SBMLConstants.VOLUME)
                                  .WithDimension(baseValue.dimension)
                                  .WithFormula(formula);

            return(volumeParameter);
        }