public void test_L3_Compartment_size()
        {
            double size = 0.2;

            assertEquals(false, C.isSetSize());
            assertEquals(true, isnan(C.getSize()));
            C.setSize(size);
            assertTrue(C.getSize() == size);
            assertEquals(true, C.isSetSize());
            C.unsetSize();
            assertEquals(false, C.isSetSize());
            assertEquals(true, isnan(C.getSize()));
        }
        public void test_L3_Compartment_initDefaults()
        {
            Compartment c = new  Compartment(3, 1);

            c.setId("A");
            assertEquals(true, c.isSetId());
            assertEquals(false, c.isSetName());
            assertEquals(false, c.isSetSize());
            assertEquals(false, c.isSetVolume());
            assertEquals(false, c.isSetUnits());
            assertEquals(false, c.isSetConstant());
            assertEquals(false, c.isSetSpatialDimensions());
            c.initDefaults();
            assertTrue(("A" == c.getId()));
            assertTrue(c.getName() == "");
            assertTrue(("litre" == c.getUnits()));
            assertTrue(c.getSpatialDimensions() == 3);
            assertTrue(c.getSize() == 1);
            assertTrue(c.getConstant() == true);
            assertEquals(true, c.isSetId());
            assertEquals(false, c.isSetName());
            assertEquals(false, c.isSetSize());
            assertEquals(false, c.isSetVolume());
            assertEquals(true, c.isSetUnits());
            assertEquals(true, c.isSetConstant());
            assertEquals(true, c.isSetSpatialDimensions());
            c = null;
        }
示例#3
0
 public void test_Compartment_unsetSize()
 {
     C.setSize(0.2);
     assertTrue(C.getSize() == 0.2);
     assertEquals(true, C.isSetSize());
     C.unsetSize();
     assertEquals(false, C.isSetSize());
 }
示例#4
0
        public void test_Compartment_setSize1()
        {
            int i = C.setSize(2.0);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(C.getSize() == 2.0);
            i = C.unsetSize();
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
        }
示例#5
0
        public void test_Compartment_setSize2()
        {
            Compartment c = new  Compartment(2, 2);
            int         i = c.setSize(4);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(c.getSize() == 4);
            assertEquals(true, c.isSetSize());
            i = c.unsetSize();
            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertEquals(false, c.isSetSize());
            c = null;
        }
示例#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);
        }
示例#7
0
        /// <summary>
        ///     Creates a container's size parameter to import the size of the particular SBML compartment.
        /// </summary>
        private IParameter CreateSizeParameter(Compartment compartment)
        {
            IFormula formula = ObjectBaseFactory.Create <ConstantFormula>().WithValue(compartment.getSize());

            var sizeParameter = _objectBaseFactory.Create <IParameter>()
                                .WithName(SBMLConstants.SIZE)
                                .WithDescription(SBMLConstants.SBML_SIZE_DESCRIPTION)
                                .WithFormula(formula);

            return(SetDimension(compartment, sizeParameter));
        }