예제 #1
0
        public void test_Compartment_setSpatialDimensions1()
        {
            int i = C.setSpatialDimensions(2);

            assertTrue(i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE);
            assertTrue(C.getSpatialDimensions() == 3);
        }
예제 #2
0
        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_setSpatialDimensions5()
        {
            Compartment c = new  Compartment(2, 2);
            int         i = c.setSpatialDimensions(2.2);

            assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE);
            assertTrue(c.getSpatialDimensions() == 3);
            c = null;
        }
예제 #4
0
        public void test_Compartment_setSpatialDimensions4()
        {
            Compartment c = new  Compartment(2, 2);
            int         i = c.setSpatialDimensions(2.0);

            assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS);
            assertTrue(c.getSpatialDimensions() == 2);
            c = null;
        }
예제 #5
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());
 }
예제 #6
0
        public void test_Compartment_createWith()
        {
            Compartment c = new  Compartment(2, 4);

            c.setId("A");
            assertTrue(c.getTypeCode() == libsbml.SBML_COMPARTMENT);
            assertTrue(c.getMetaId() == "");
            assertTrue(c.getNotes() == null);
            assertTrue(c.getAnnotation() == null);
            assertTrue(c.getName() == "");
            assertTrue(c.getSpatialDimensions() == 3);
            assertTrue(("A" == c.getId()));
            assertTrue(c.getConstant() == true);
            assertEquals(true, c.isSetId());
            assertEquals(false, c.isSetName());
            c = null;
        }
예제 #7
0
        /// <summary>
        ///     Sets the dimension of a MoBi container to the Unit of the SBML compartment.
        /// </summary>
        private IParameter SetDimension(Compartment compartment, IParameter sizeParameter)
        {
            var spatialDimensions = compartment.getSpatialDimensions();

            IDimension sizeDimension;

            switch (spatialDimensions)
            {
            case (SBMLConstants.SBML_CONTAINER_3D):
                sizeDimension = !compartment.isSetUnits()
                  ? _dimensionFactory.Dimension(Constants.Dimension.VOLUME)
                  : GetDimensionFromSBMLUnit(compartment.getUnits());
                break;

            case (SBMLConstants.SBML_CONTAINER_2D):
                sizeDimension = !compartment.isSetUnits()
                  ? _dimensionFactory.Dimension(SBMLConstants.AREA)
                  : GetDimensionFromSBMLUnit(compartment.getUnits());
                break;

            case (SBMLConstants.SBML_CONTAINER_1D):
                sizeDimension = !compartment.isSetUnits()
                  ? _dimensionFactory.Dimension(SBMLConstants.LENGTH)
                  : GetDimensionFromSBMLUnit(compartment.getUnits());
                break;

            case (SBMLConstants.SBML_CONTAINER_NO):
                //no size & units allowed
                return(null);

            default:
                sizeDimension = _dimensionFactory.Dimension(Constants.Dimension.DIMENSIONLESS);
                break;
            }
            if (sizeDimension != null)
            {
                sizeParameter.Dimension = sizeDimension;
            }

            return(sizeParameter);
        }
예제 #8
0
        public void test_Compartment_createWithNS()
        {
            XMLNamespaces xmlns = new  XMLNamespaces();

            xmlns.add("http://www.sbml.org", "testsbml");
            SBMLNamespaces sbmlns = new  SBMLNamespaces(2, 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() == 2);
            assertTrue(c.getVersion() == 1);
            assertTrue(c.getNamespaces() != null);
            assertTrue(c.getNamespaces().getLength() == 2);
            assertTrue(c.getName() == "");
            assertTrue(c.getSpatialDimensions() == 3);
            assertTrue(c.getConstant() == true);
            c = null;
        }