Esempio n. 1
0
 public void setUp()
 {
     C = new  Compartment(2,4);
       if (C == null);
       {
       }
 }
 public void setUp()
 {
     string filename = "../../sbml/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;
 }
Esempio n. 4
0
 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_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;
 }
Esempio n. 6
0
 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_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;
 }
Esempio n. 8
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;
 }
Esempio n. 9
0
 public void test_ListOf_append()
 {
     Model m = new  Model(2,4);
       m.createCompartment();
       ListOf loc = m.getListOfCompartments();
       assertTrue( loc.size() == 1 );
       SBase c = new  Compartment(2,4);
       int i = loc.append(c);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( loc.size() == 2 );
       SBase sp = new  Species(2,4);
       i = loc.append(sp);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertTrue( loc.size() == 2 );
       m = null;
       sp = null;
 }
Esempio n. 10
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;
 }
 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;
 }
 public void test_SBMLConvert_convertToL1_Species_Amount()
 {
     SBMLDocument d = new  SBMLDocument(2,4);
       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_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;
 }
Esempio n. 14
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 );
 }
 public void test_Compartment_parent_add()
 {
     Compartment c = new Compartment(2,4);
       c.setId("c");
       Model m = new Model(2,4);
       m.addCompartment(c);
       c = null;
       ListOf lo = m.getListOfCompartments();
       assertTrue( lo == m.getCompartment(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
Esempio n. 16
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;
 }
 public void test_Compartment()
 {
     Compartment c = new Compartment(2,4);
       assertEquals( true, c.hasRequiredElements() );
       c = null;
 }
Esempio n. 18
0
 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;
 }
Esempio n. 19
0
 public void tearDown()
 {
     C = null;
 }
Esempio n. 20
0
 public void test_RDFAnnotation_parseCVTerms()
 {
     XMLNode node = RDFAnnotationParser.parseCVTerms(m.getCompartment(0));
       assertTrue( node.getNumChildren() == 1 );
       XMLNode rdf = node.getChild(0);
       assertTrue((  "RDF" == rdf.getName() ));
       assertTrue((  "rdf" == rdf.getPrefix() ));
       assertTrue((  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" == rdf.getURI() ));
       assertTrue( rdf.getNumChildren() == 1 );
       XMLNode desc = rdf.getChild(0);
       assertTrue((  "Description" == desc.getName() ));
       assertTrue((  "rdf" == desc.getPrefix() ));
       assertTrue((  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" == desc.getURI() ));
       assertTrue( desc.getNumChildren() == 1 );
       XMLNode is1 = desc.getChild(0);
       assertTrue((  "is" == is1.getName() ));
       assertTrue((  "bqbiol" == is1.getPrefix() ));
       assertTrue( is1.getNumChildren() == 1 );
       XMLNode Bag = is1.getChild(0);
       assertTrue((  "Bag" == Bag.getName() ));
       assertTrue((  "rdf" == Bag.getPrefix() ));
       assertTrue((  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" == Bag.getURI() ));
       assertTrue( Bag.getNumChildren() == 4 );
       XMLNode li = Bag.getChild(0);
       assertTrue((  "li" == li.getName() ));
       assertTrue((  "rdf" == li.getPrefix() ));
       assertTrue((  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li.getURI() ));
       assertTrue( li.getNumChildren() == 0 );
       XMLNode li1 = Bag.getChild(1);
       assertTrue((  "li" == li1.getName() ));
       assertTrue((  "rdf" == li1.getPrefix() ));
       assertTrue((  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li1.getURI() ));
       assertTrue( li1.getNumChildren() == 0 );
       XMLNode li2 = Bag.getChild(2);
       assertTrue((  "li" == li2.getName() ));
       assertTrue((  "rdf" == li2.getPrefix() ));
       assertTrue((  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li2.getURI() ));
       assertTrue( li2.getNumChildren() == 0 );
       XMLNode li3 = Bag.getChild(3);
       assertTrue((  "li" == li3.getName() ));
       assertTrue((  "rdf" == li3.getPrefix() ));
       assertTrue((  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" == li3.getURI() ));
       assertTrue( li3.getNumChildren() == 0 );
       node = null;
       XMLNode node1 = RDFAnnotationParser.parseCVTerms(null);
       assertTrue( node1 == null );
       node1 = RDFAnnotationParser.createCVTerms(null);
       assertTrue( node1 == null );
       node1 = RDFAnnotationParser.parseCVTerms(m.getCompartment(2));
       assertTrue( node1 == null );
       node1 = RDFAnnotationParser.createCVTerms(m.getCompartment(2));
       assertTrue( node1 == null );
       node1 = RDFAnnotationParser.parseCVTerms(m);
       assertTrue( node1 == null );
       node1 = RDFAnnotationParser.createCVTerms(m);
       assertTrue( node1 == null );
       Compartment c = new Compartment(3,1);
       c.setMetaId("_002");
       node1 = RDFAnnotationParser.parseCVTerms(c);
       assertTrue( node1 == null );
       node1 = RDFAnnotationParser.createCVTerms(c);
       assertTrue( node1 == null );
       CVTerm cv = new CVTerm(libsbml.BIOLOGICAL_QUALIFIER);
       cv.setBiologicalQualifierType(23);
       cv.addResource("http://myres");
       c.addCVTerm(cv);
       node1 = RDFAnnotationParser.createCVTerms(c);
       assertTrue( node1 == null );
       c = null;
       Model m1 = new Model(3,1);
       m1.setMetaId("_002");
       cv = new CVTerm(libsbml.MODEL_QUALIFIER);
       cv.setModelQualifierType(23);
       cv.addResource("http://myres");
       m1.addCVTerm(cv);
       node1 = RDFAnnotationParser.createCVTerms(m1);
       assertTrue( node1 == null );
 }
Esempio n. 21
0
 /**
    * Copy constructor; creates a copy of a Compartment.
    *
    * @param orig the Compartment instance to copy.
    *
    * @throws @if python ValueError @else SBMLConstructorException @endif
    * Thrown if the argument @p orig is @c null.
    */
 public Compartment(Compartment orig)
     : this(libsbmlPINVOKE.new_Compartment__SWIG_2(Compartment.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 22
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;
        }
Esempio n. 23
0
 internal static HandleRef getCPtr(Compartment obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Esempio n. 24
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_internal_consistency_check_99904()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Compartment c = new Compartment(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       c.setId("c");
       c.setMetaId("mmm");
       m.addCompartment(c);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 1 );
       assertTrue( d.getError(0).getErrorId() == 10103 );
       d = null;
 }
Esempio n. 26
0
 public void test_Compartment_ancestor_add()
 {
     Compartment c = new Compartment(2,4);
       c.setId("C");
       Model m = new Model(2,4);
       m.addCompartment(c);
       c = null;
       ListOf lo = m.getListOfCompartments();
       Compartment obj = m.getCompartment(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 );
 }
Esempio n. 27
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 libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink
    * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink
    * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    * @li @link 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;
 }
 public void test_SBase_setSBOTerm1()
 {
     SBase c = new Compartment(1,2);
       int i = c.setSBOTerm(2);
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertEquals( false, c.isSetSBOTerm() );
       c = null;
 }
        public void test_Compartment_constructor()
        {
            SBase s;

              try
              {
            s = new Compartment(1,1);
            s = new Compartment(1,2);
            s = new Compartment(2,1);
            s = new Compartment(2,2);
            s = new Compartment(2,3);
            s = new Compartment(2,4);
            s = new Compartment(3,1);
            s = new Compartment(SN11);
            s = new Compartment(SN12);
            s = new Compartment(SN21);
            s = new Compartment(SN22);
            s = new Compartment(SN23);
            s = new Compartment(SN24);
            s = new Compartment(SN31);
              }
              catch (SBMLConstructorException e)
              {
             s = null;
              }
              assertTrue(s != null);

              string msg = "";

              try
              {
            s = new Compartment(9,9);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";

              try
              {
            s = new Compartment(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";

              try
              {
            s = new Compartment(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
Esempio n. 30
0
 public void test_Model_getCompartment()
 {
     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 );
       c1 = M.getCompartment(0);
       c2 = M.getCompartment(1);
       assertTrue((  "A" == c1.getId() ));
       assertTrue((  "B" == c2.getId() ));
 }