libsbmlcs.L3ParserSettings.setParseLog C# (CSharp) Method

setParseLog() public method

public setParseLog ( int type ) : void
type int
return void
        public void setParseLog(int type)
        {
            libsbmlPINVOKE.L3ParserSettings_setParseLog(swigCPtr, type);
        }

Usage Example

コード例 #1
0
 public void test_SBML_C_parseL3Formula_parselogsettings()
 {
     ASTNode r = libsbml.parseL3Formula("log(4.4)");
       ASTNode c;
       assertTrue( r.getType() == libsbml.AST_FUNCTION_LOG );
       assertTrue( r.getNumChildren() == 2 );
       c = r.getLeftChild();
       assertTrue( c.getType() == libsbml.AST_INTEGER );
       assertTrue( c.getInteger() == 10 );
       assertTrue( c.getNumChildren() == 0 );
       c = r.getRightChild();
       assertTrue( c.getType() == libsbml.AST_REAL );
       assertTrue( c.getReal() == 4.4 );
       assertTrue( c.getNumChildren() == 0 );
       r = null;
       L3ParserSettings settings = new  L3ParserSettings();
       settings.setParseLog(libsbml.L3P_PARSE_LOG_AS_LN);
       assertTrue( settings.getParseLog() == libsbml.L3P_PARSE_LOG_AS_LN );
       r = libsbml.parseL3FormulaWithSettings("log(4.4)", settings);
       assertTrue( r.getType() == libsbml.AST_FUNCTION_LN );
       assertTrue( r.getNumChildren() == 1 );
       c = r.getLeftChild();
       assertTrue( c.getType() == libsbml.AST_REAL );
       assertTrue( c.getReal() == 4.4 );
       assertTrue( c.getNumChildren() == 0 );
       r = null;
       settings.setParseLog(libsbml.L3P_PARSE_LOG_AS_LOG10);
       assertTrue( settings.getParseLog() == libsbml.L3P_PARSE_LOG_AS_LOG10 );
       r = libsbml.parseL3FormulaWithSettings("log(4.4)", settings);
       assertTrue( r.getType() == libsbml.AST_FUNCTION_LOG );
       assertTrue( r.getNumChildren() == 2 );
       c = r.getLeftChild();
       assertTrue( c.getType() == libsbml.AST_INTEGER );
       assertTrue( c.getInteger() == 10 );
       assertTrue( c.getNumChildren() == 0 );
       c = r.getRightChild();
       assertTrue( c.getType() == libsbml.AST_REAL );
       assertTrue( c.getReal() == 4.4 );
       assertTrue( c.getNumChildren() == 0 );
       r = null;
       settings.setParseLog(libsbml.L3P_PARSE_LOG_AS_ERROR);
       assertTrue( settings.getParseLog() == libsbml.L3P_PARSE_LOG_AS_ERROR );
       r = libsbml.parseL3FormulaWithSettings("log(4.4)", settings);
       assertTrue( r == null );
       assertTrue((  "Error when parsing input 'log(4.4)' at position 8:  Writing a function as 'log(x)' was legal in the L1 parser, but translated as the natural log, not the base-10 log.  This construct is disallowed entirely as being ambiguous, and you are encouraged instead to use 'ln(x)', 'log10(x)', or 'log(base, x)'." == libsbml.getLastParseL3Error() ));
       settings = null;
 }