Example #1
0
 public void setUp()
 {
     C = new  Compartment(3,1);
       if (C == null);
       {
       }
 }
 public void setUp()
 {
     string filename = "../../annotation/test/test-data/annotationL3.xml";
       d = libsbml.readSBML(filename);
       m = d.getModel();
       c = m.getCompartment(0);
 }
 public void test_Compartment()
 {
     Compartment c = new Compartment(2,4);
       assertEquals( false, (c.hasRequiredAttributes()) );
       c.setId("c");
       assertEquals( true, c.hasRequiredAttributes() );
       c = null;
 }
 public void test_Compartment_setCompartmentType2()
 {
     Compartment c = new  Compartment(2,2);
       int i = c.setCompartmentType( "1cell");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertEquals( false, c.isSetCompartmentType() );
       i = c.unsetCompartmentType();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetCompartmentType() );
       c = null;
 }
 public void test_Model_addCompartment2()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,1);
       c.setId( "c");
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumCompartments() == 0 );
       c = null;
       m = null;
 }
 public void test_Model_addCompartment1()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,2);
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       c.setId( "c");
       i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumCompartments() == 1 );
       c = null;
       m = null;
 }
 public void test_internal_consistency_check_99902()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Compartment c = new Compartment(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       c.setCompartmentType("hh");
       c.setId("c");
       m.addCompartment(c);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 1 );
       assertTrue( d.getError(0).getErrorId() == 10103 );
       d = null;
 }
Example #8
0
 public void test_Compartment_assignmentOperator()
 {
     Compartment o1 = new Compartment(2,4);
       o1.setId("c");
       o1.setOutside("c2");
       assertTrue( o1.getId() ==  "c" );
       assertTrue( o1.getOutside() ==  "c2" );
       Compartment o2 = new Compartment(2,4);
       o2 = o1;
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getOutside() ==  "c2" );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_internal_consistency_check_99903()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Compartment c = new Compartment(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       c.setConstant(true);
       c.setId("c");
       m.addCompartment(c);
       Rule r = m.createAssignmentRule();
       r.setVariable("c");
       r.setFormula("2*3");
       errors = d.checkInternalConsistency();
       assertTrue( errors == 3 );
       d = null;
 }
Example #10
0
 public void test_L3_Compartment_hasRequiredAttributes()
 {
     Compartment c = new  Compartment(3,1);
       assertEquals( false, c.hasRequiredAttributes() );
       c.setId( "id");
       assertEquals( false, c.hasRequiredAttributes() );
       c.setConstant(false);
       assertEquals( true, c.hasRequiredAttributes() );
       c = null;
 }
Example #11
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;
 }
 public void test_Compartment_setCompartmentType4()
 {
     Compartment c = new  Compartment(2,2);
       int i = c.setCompartmentType("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetCompartmentType() );
       c = null;
 }
Example #13
0
 public void test_Model_addCompartment()
 {
     Compartment c = new  Compartment(2,4);
       c.setId( "c");
       M.addCompartment(c);
       assertTrue( M.getNumCompartments() == 1 );
 }
 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;
 }
Example #15
0
 public void test_SBMLConvert_convertToL1_Species_Amount()
 {
     SBMLDocument d = new  SBMLDocument(2,1);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,4);
       Species s = new  Species(2,4);
       c.setId(sid);
       m.addCompartment(c);
       s.setCompartment(sid);
       s.setInitialAmount(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       assertTrue( s.getInitialAmount() == 2.34 );
       d = null;
 }
 public void test_Model_addCompartment5()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,2);
       c.setId( "c");
       Compartment c1 = new  Compartment(2,2);
       c1.setId( "c");
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumCompartments() == 1 );
       i = m.addCompartment(c1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumCompartments() == 1 );
       c = null;
       c1 = null;
       m = null;
 }
Example #17
0
        internal static HandleRef getCPtrAndDisown(Compartment obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
Example #18
0
 public void test_Compartment_copyConstructor()
 {
     Compartment o1 = new Compartment(2,4);
       o1.setId("c");
       o1.setOutside("c2");
       assertTrue( o1.getId() ==  "c" );
       assertTrue( o1.getOutside() ==  "c2" );
       Compartment o2 = new Compartment(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getOutside() ==  "c2" );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_Compartment_setConstant2()
 {
     Compartment c = new  Compartment(2,2);
       int i = c.setConstant(false);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( c.getConstant() == false );
       c = null;
 }
Example #20
0
 /**
    * Adds a copy of the given Compartment object to this Model.
    *
    * @param c the Compartment object to add
    *
    * @return integer value indicating success/failure of the
    * function.  The possible values
    * returned by this function are:
    * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED @endlink
    *
    * *
  * @note This method should be used with some caution.  The fact that this
  * method @em copies the object passed to it means that the caller will be
  * left holding a physically different object instance than the one contained
  * inside this object.  Changes made to the original object instance (such as
  * resetting attribute values) will <em>not affect the instance in this
  * object</em>.  In addition, the caller should make sure to free the
  * original object if it is no longer being used, or else a memory leak will
  * result.  Please see other methods on this class (particularly a
  * corresponding method whose name begins with the word <code>create</code>)
  * for alternatives that do not lead to these issues.
  *
  *
    *
    * @see createCompartment()
    */
 public int addCompartment(Compartment c)
 {
     int ret = libsbmlPINVOKE.Model_addCompartment(swigCPtr, Compartment.getCPtr(c));
     return ret;
 }
Example #21
0
 public void test_SBMLConvert_convertToL1_Species_Concentration()
 {
     SBMLDocument d = new  SBMLDocument(2,1);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,1);
       Species s = new  Species(2,1);
       c.setId(sid);
       c.setSize(1.2);
       m.addCompartment(c);
       s.setId( "s"  );
       s.setCompartment(sid);
       s.setInitialConcentration(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       Species s1 = m.getSpecies(0);
       assertTrue( s1 != null );
       assertTrue((  "C" == s1.getCompartment() ));
       assertTrue( m.getCompartment( "C").getSize() == 1.2 );
       assertTrue( s1.getInitialConcentration() == 2.34 );
       assertTrue( s1.isSetInitialConcentration() == true );
       d = null;
 }
Example #22
0
 public void test_Model_getCompartmentById()
 {
     Compartment c1 = new  Compartment(2,4);
       Compartment c2 = new  Compartment(2,4);
       c1.setId( "A" );
       c2.setId( "B" );
       M.addCompartment(c1);
       M.addCompartment(c2);
       assertTrue( M.getNumCompartments() == 2 );
       assertTrue( M.getCompartment( "A" ) != c1 );
       assertTrue( M.getCompartment( "B" ) != c2 );
       assertTrue( M.getCompartment( "C" ) == null );
 }
Example #23
0
 public void tearDown()
 {
     C = null;
 }
 public void test_Compartment()
 {
     Compartment c = new Compartment(2,4);
       assertEquals( true, c.hasRequiredElements() );
       c = null;
 }
 public void test_Compartment_setId2()
 {
     Compartment c = new  Compartment(2,2);
       int i = c.setId( "1cell");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertEquals( false, c.isSetId() );
       c = null;
 }
 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;
 }
Example #27
0
 internal static HandleRef getCPtr(Compartment obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public void test_Compartment_setId3()
 {
     Compartment c = new  Compartment(2,2);
       int i = c.setId( "cell");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, c.isSetId() );
       assertTrue((  "cell"  == c.getId() ));
       c = null;
 }
Example #29
0
 public Compartment(Compartment orig)
     : this(libsbmlPINVOKE.new_Compartment__SWIG_2(Compartment.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 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;
 }