getNumUnitDefinitions() public method

public getNumUnitDefinitions ( ) : long
return long
Exemplo n.º 1
0
 public void test_Model_addUnitDefinition5()
 {
     Model m = new  Model(2,2);
       UnitDefinition ud = new  UnitDefinition(2,2);
       ud.setId( "ud");
       ud.createUnit();
       UnitDefinition ud1 = new  UnitDefinition(2,2);
       ud1.setId( "ud");
       ud1.createUnit();
       int i = m.addUnitDefinition(ud);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumUnitDefinitions() == 1 );
       i = m.addUnitDefinition(ud1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumUnitDefinitions() == 1 );
       ud = null;
       ud1 = null;
       m = null;
 }
Exemplo n.º 2
0
 public void test_Model_createUnitDefinition()
 {
     Model m = new  Model(2,2);
       UnitDefinition p = m.createUnitDefinition();
       assertTrue( m.getNumUnitDefinitions() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
Exemplo n.º 3
0
 public void test_Model_addUnitDefinition3()
 {
     Model m = new  Model(2,2);
       UnitDefinition ud = new  UnitDefinition(1,2);
       ud.createUnit();
       ud.setId( "ud");
       int i = m.addUnitDefinition(ud);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumUnitDefinitions() == 0 );
       ud = null;
       m = null;
 }
Exemplo n.º 4
0
 public void test_Model_addUnitDefinition4()
 {
     Model m = new  Model(2,2);
       UnitDefinition ud = null;
       int i = m.addUnitDefinition(ud);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumUnitDefinitions() == 0 );
       m = null;
 }
Exemplo n.º 5
0
 public void test_ReadSBML_Unit_L2()
 {
     Unit u;
       UnitDefinition ud;
       string s = wrapSBML_L2v1("<listOfUnitDefinitions>" +
     "  <unitDefinition id='Fahrenheit'>" +
     "    <listOfUnits>" +
     "      <unit kind='Celsius' multiplier='1.8' offset='32'/>" +
     "    </listOfUnits>" +
     "  </unitDefinition>" +
     "</listOfUnitDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumUnitDefinitions() == 1 );
       ud = M.getUnitDefinition(0);
       assertEquals( true, ud.isSetId() );
       assertTrue((  "Fahrenheit" == ud.getId() ));
       assertTrue( ud.getNumUnits() == 1 );
       u = ud.getUnit(0);
       assertTrue( u.getKind() == libsbml.UNIT_KIND_CELSIUS );
       assertTrue( u.getExponent() == 1 );
       assertTrue( u.getScale() == 0 );
       assertTrue( u.getMultiplier() == 1.8 );
       assertTrue( u.getOffset() == 32 );
 }
Exemplo n.º 6
0
 public void test_ReadSBML_Unit_defaults_L1_L2()
 {
     Unit u;
       UnitDefinition ud;
       string s = wrapSBML_L1v2("<listOfUnitDefinitions>" +
     "  <unitDefinition name='bogomips'>" +
     "    <listOfUnits> <unit kind='second'/> </listOfUnits>" +
     "  </unitDefinition>" +
     "</listOfUnitDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumUnitDefinitions() == 1 );
       ud = M.getUnitDefinition(0);
       assertTrue((  "bogomips" == ud.getId() ));
       assertTrue( ud.getNumUnits() == 1 );
       u = ud.getUnit(0);
       assertTrue( u.getKind() == libsbml.UNIT_KIND_SECOND );
       assertTrue( u.getExponent() == 1 );
       assertTrue( u.getScale() == 0 );
       assertTrue( u.getMultiplier() == 1.0 );
       assertTrue( u.getOffset() == 0.0 );
 }
Exemplo n.º 7
0
 public void test_ReadSBML_UnitDefinition_L2()
 {
     UnitDefinition ud;
       string s = wrapSBML_L2v1("<listOfUnitDefinitions>" +
     "  <unitDefinition id='mmls' name='mmol/ls'/>" +
     "</listOfUnitDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumUnitDefinitions() == 1 );
       ud = M.getUnitDefinition(0);
       assertEquals( true, ud.isSetId() );
       assertEquals( true, ud.isSetName() );
       assertTrue((  "mmls" == ud.getId() ));
       assertTrue((  "mmol/ls" == ud.getName() ));
 }
Exemplo n.º 8
0
 public void test_ReadSBML_UnitDefinition()
 {
     UnitDefinition ud;
       string s = wrapSBML_L1v2("<listOfUnitDefinitions>" +
     "  <unitDefinition name='mmls'/>" +
     "</listOfUnitDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumUnitDefinitions() == 1 );
       ud = M.getUnitDefinition(0);
       assertTrue((  "mmls" == ud.getId() ));
 }
Exemplo n.º 9
0
 public void test_ReadSBML_Unit()
 {
     Unit u;
       UnitDefinition ud;
       string s = wrapSBML_L1v2("<listOfUnitDefinitions>" +
     "  <unitDefinition name='substance'>" +
     "    <listOfUnits> <unit kind='mole' scale='-3'/> </listOfUnits>" +
     "  </unitDefinition>" +
     "</listOfUnitDefinitions>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M.getNumUnitDefinitions() == 1 );
       ud = M.getUnitDefinition(0);
       assertTrue((  "substance" == ud.getId() ));
       assertTrue( ud.getNumUnits() == 1 );
       u = ud.getUnit(0);
       assertTrue( u.getKind() == libsbml.UNIT_KIND_MOLE );
       assertTrue( u.getExponent() == 1 );
       assertTrue( u.getScale() == -3 );
 }