getId() public method

public getId ( ) : string
return string
 public void test_FunctionDefinition_createWith()
 {
     ASTNode math = libsbml.parseFormula("lambda(x, x^3)");
       FunctionDefinition fd = new  FunctionDefinition(2,4);
       fd.setId( "pow3");
       fd.setMath(math);
       ASTNode math1;
       string formula;
       assertTrue( fd.getTypeCode() == libsbml.SBML_FUNCTION_DEFINITION );
       assertTrue( fd.getMetaId() == "" );
       assertTrue( fd.getNotes() == null );
       assertTrue( fd.getAnnotation() == null );
       assertTrue( fd.getName() == "" );
       math1 = fd.getMath();
       assertTrue( math1 != null );
       formula = libsbml.formulaToString(math1);
       assertTrue( formula != null );
       assertTrue((  "lambda(x, x^3)" == formula ));
       assertTrue( fd.getMath() != math );
       assertEquals( true, fd.isSetMath() );
       assertTrue((  "pow3" == fd.getId() ));
       assertEquals( true, fd.isSetId() );
       math = null;
       fd = null;
 }
Example #2
0
    private static void printFunctionDefinition(int n, FunctionDefinition fd)
    {
        ASTNode math;
        string formula;

        if (fd.isSetMath())
        {
            Console.Write("FunctionDefinition " + n + ", " + fd.getId());

            math = fd.getMath();

            /* Print function arguments. */
            if (math.getNumChildren() > 1)
            {
                Console.Write("(" + (math.getLeftChild()).getName());

                for (n = 1; n < math.getNumChildren() - 1; ++n)
                {
                    Console.Write(", " + (math.getChild(n)).getName());
                }
            }

            Console.Write(") := ");

            /* Print function body. */
            if (math.getNumChildren() == 0)
            {
                Console.Write("(no body defined)");
            }
            else
            {
                math = math.getChild(math.getNumChildren() - 1);
                formula = libsbml.formulaToString(math);
                Console.Write(formula + Environment.NewLine);

            }
        }
    }
 public void test_FunctionDefinition_copyConstructor()
 {
     FunctionDefinition o1 = new FunctionDefinition(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       ASTNode node = new ASTNode(libsbml.AST_CONSTANT_PI);
       o1.setMath(node);
       node = null;
       assertTrue( o1.getMath() != null );
       FunctionDefinition o2 = new FunctionDefinition(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getMath() != null );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }