def add_ast_as_product(self, ast, r): if ast is None: # if there is no parent, return v1. root = r.getKineticLaw().getMath().deepCopy() else: root = ASTNode(AST_PLUS) root.addChild(ast) root.addChild(r.getKineticLaw().getMath().deepCopy()) return root
def add_ast_as_reactant(self, ast, r): if ast is None: # if there is no parent, return -1 * v1. root = ASTNode(AST_TIMES) l = ASTNode() l.setValue(-1.0) root.addChild(l) root.addChild(r.getKineticLaw().getMath().deepCopy()) else: root = ASTNode(AST_MINUS) root.addChild(ast) root.addChild(r.getKineticLaw().getMath().deepCopy()) return root