setMath() public method

public setMath ( ASTNode math ) : int
math ASTNode
return int
コード例 #1
0
 public void test_StoichiometryMath()
 {
     StoichiometryMath sm = new StoichiometryMath(2,4);
       assertEquals( false, (sm.hasRequiredElements()) );
       sm.setMath(libsbml.parseFormula("ar"));
       assertEquals( true, sm.hasRequiredElements() );
       sm = null;
 }
コード例 #2
0
 public void test_SpeciesReference_setStoichiometryMath6()
 {
     StoichiometryMath sm = new  StoichiometryMath(2,1);
       sm.setMath(libsbml.parseFormula("1"));
       int i = sr.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertEquals( false, sr.isSetStoichiometryMath() );
       sm = null;
 }
コード例 #3
0
 public void test_SpeciesReference_setStoichiometryMath()
 {
     ASTNode math = libsbml.parseFormula("k3 / k2");
       StoichiometryMath stoich = new  StoichiometryMath(2,4);
       stoich.setMath(math);
       StoichiometryMath math1;
       string formula;
       SR.setStoichiometryMath(stoich);
       math1 = SR.getStoichiometryMath();
       assertTrue( math1 != null );
       formula = libsbml.formulaToString(math1.getMath());
       assertTrue( formula != null );
       assertTrue((  "k3 / k2" == formula ));
       assertEquals( true, SR.isSetStoichiometryMath() );
 }
コード例 #4
0
 public void test_SpeciesReference_setStoichiometryMath5()
 {
     SpeciesReference sr1 = new  SpeciesReference(1,2);
       StoichiometryMath sm = new  StoichiometryMath(2,4);
       ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       ASTNode b = new  ASTNode();
       a.setName( "a");
       b.setName( "b");
       math.addChild(a);
       math.addChild(b);
       sm.setMath(math);
       int i = sr1.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertEquals( false, sr1.isSetStoichiometryMath() );
       sm = null;
       sr1 = null;
 }
コード例 #5
0
 public void test_SpeciesReference_setStoichiometryMath4()
 {
     StoichiometryMath sm = new  StoichiometryMath(2,4);
       ASTNode math = null;
       sm.setMath(math);
       int i = sr.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertEquals( false, sr.isSetStoichiometryMath() );
       assertTrue( sr.getStoichiometry() == 1 );
       i = sr.unsetStoichiometryMath();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, sr.isSetStoichiometryMath() );
       sm = null;
 }
コード例 #6
0
 public void test_SpeciesReference_setStoichiometryMath2()
 {
     StoichiometryMath sm = new  StoichiometryMath(2,4);
       ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       a.setName( "a");
       math.addChild(a);
       sm.setMath(math);
       int i = sr.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, sr.isSetStoichiometryMath() );
       sm = null;
 }
コード例 #7
0
 public void test_StoichiometryMath_parent_add()
 {
     StoichiometryMath m = new StoichiometryMath(2,4);
       m.setMath(libsbml.parseFormula("1"));
       SpeciesReference sr = new SpeciesReference(2, 4);
       sr.setStoichiometryMath(m);
       m = null;
       assertTrue( sr == sr.getStoichiometryMath().getParentSBMLObject() );
       sr = null;
 }
コード例 #8
0
 public void test_StoichiometryMath_ancestor_add()
 {
     StoichiometryMath m = new StoichiometryMath(2,4);
       m.setMath(libsbml.parseFormula("1"));
       SpeciesReference sr = new SpeciesReference(2, 4);
       sr.setStoichiometryMath(m);
       m = null;
       StoichiometryMath obj = sr.getStoichiometryMath();
       assertTrue( obj.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       sr = null;
 }