getMath() public method

public getMath ( ) : ASTNode
return ASTNode
Exemplo n.º 1
0
        /// <summary>
        ///    Creates the Mobi Event Assignment for one SBML Event Assignment.
        /// </summary>
        internal void CreateEventAssignment(EventAssignment eventAssignment)
        {
            _counter++;
            var assignmentVar = eventAssignment.getVariable();
            var alias         = _sbmlInformation.AliasCreator.CreateAliasFrom(assignmentVar) + _counter;

            var description = String.Empty;

            if (eventAssignment.isSetNotes())
            {
                description += eventAssignment.getNotesString();
            }
            if (eventAssignment.isSetSBOTerm())
            {
                description += (SBMLConstants.SPACE + eventAssignment.getSBOTerm());
            }

            IEventAssignmentBuilder eab = new EventAssignmentBuilder()
                                          .WithId(eventAssignment.getId() + SBMLConstants.SPACE + eventAssignment.getName() + SBMLConstants.SPACE + alias)
                                          .WithName(SBMLConstants.SBML_EVENT_ASSIGNMENT + eventAssignment.getId())
                                          .WithDescription(description);

            var formula = _astHandler.Parse(eventAssignment.getMath(), eab, assignmentVar, _sbmlProject, _sbmlInformation) ??
                          ObjectBaseFactory.Create <ExplicitFormula>().WithFormulaString(String.Empty).WithName(SBMLConstants.DEFAULT_FORMULA_NAME);

            eab.Formula = formula;
            EventGroupBuildingBlock.FormulaCache.Add(formula);
            EventBuilder.AddAssignment(eab);
        }
Exemplo n.º 2
0
    private static void printEventAssignmentMath(int n, EventAssignment ea)
    {
        string variable;
        string formula;

        if (ea.isSetMath())
        {
            variable = ea.getVariable();
            formula = libsbml.formulaToString(ea.getMath());

            Console.Write("  EventAssignment " + n
                                  + ", trigger: " + variable + " = " + formula + Environment.NewLine);

        }
    }
Exemplo n.º 3
0
 public void test_EventAssignment_copyConstructor()
 {
     EventAssignment o1 = new EventAssignment(2,4);
       o1.setVariable("c2");
       assertTrue( o1.getVariable() ==  "c2" );
       ASTNode node = new ASTNode(libsbml.AST_CONSTANT_PI);
       o1.setMath(node);
       node = null;
       assertTrue( o1.getMath() != null );
       EventAssignment o2 = new EventAssignment(o1);
       assertTrue( o2.getVariable() ==  "c2" );
       assertTrue( o2.getMath() != null );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }