public void test_InitialAssignment_setSymbol1() { string id = "1e1"; int i = E.setSymbol(id); assertTrue(i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE); assertEquals(false, E.isSetSymbol()); }
public void test_InitialAssignment() { InitialAssignment ia = new InitialAssignment(2, 4); assertEquals(false, (ia.hasRequiredAttributes())); ia.setSymbol("ia"); assertEquals(true, ia.hasRequiredAttributes()); ia = null; }
public void test_InitialAssignment_copyConstructor() { InitialAssignment o1 = new InitialAssignment(2, 4); o1.setSymbol("c"); assertTrue(o1.getId() == "c"); InitialAssignment o2 = new InitialAssignment(o1); assertTrue(o2.getId() == "c"); assertTrue(o2.getParentSBMLObject() == o1.getParentSBMLObject()); o2 = null; o1 = null; }
public void test_InitialAssignment_parent_add() { InitialAssignment ia = new InitialAssignment(2, 4); Model m = new Model(2, 4); ia.setSymbol("c"); ia.setMath(libsbml.parseFormula("9")); m.addInitialAssignment(ia); ia = null; ListOf lo = m.getListOfInitialAssignments(); assertTrue(lo == m.getInitialAssignment(0).getParentSBMLObject()); assertTrue(m == lo.getParentSBMLObject()); }
public void test_Model_addInitialAssignment2() { Model m = new Model(2, 2); InitialAssignment ia = new InitialAssignment(2, 3); ia.setSymbol("i"); ia.setMath(libsbml.parseFormula("gg")); int i = m.addInitialAssignment(ia); assertTrue(i == libsbml.LIBSBML_VERSION_MISMATCH); assertTrue(m.getNumInitialAssignments() == 0); ia = null; m = null; }
public void test_InitialAssignment_setSymbol() { string Symbol = "k2"; IA.setSymbol(Symbol); assertTrue((Symbol == IA.getSymbol())); assertEquals(true, IA.isSetSymbol()); if (IA.getSymbol() == Symbol) { ; } { } IA.setSymbol(IA.getSymbol()); assertTrue((Symbol == IA.getSymbol())); IA.setSymbol(""); assertEquals(false, IA.isSetSymbol()); if (IA.getSymbol() != null) { ; } { } }
public void test_Model_addInitialAssignment1() { Model m = new Model(2, 2); InitialAssignment ia = new InitialAssignment(2, 2); int i = m.addInitialAssignment(ia); assertTrue(i == libsbml.LIBSBML_INVALID_OBJECT); ia.setSymbol("i"); i = m.addInitialAssignment(ia); assertTrue(i == libsbml.LIBSBML_INVALID_OBJECT); ia.setMath(libsbml.parseFormula("gg")); i = m.addInitialAssignment(ia); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(m.getNumInitialAssignments() == 1); ia = null; m = null; }
public void test_InitialAssignment_ancestor_add() { InitialAssignment ia = new InitialAssignment(2, 4); Model m = new Model(2, 4); ia.setSymbol("c"); ia.setMath(libsbml.parseFormula("9")); m.addInitialAssignment(ia); ia = null; ListOf lo = m.getListOfInitialAssignments(); InitialAssignment obj = m.getInitialAssignment(0); assertTrue(obj.getAncestorOfType(libsbml.SBML_MODEL) == m); assertTrue(obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo); assertTrue(obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null); assertTrue(obj.getAncestorOfType(libsbml.SBML_EVENT) == null); }
public void test_Model_addInitialAssignment4() { Model m = new Model(2, 2); InitialAssignment ia = new InitialAssignment(2, 2); ia.setSymbol("ia"); ia.setMath(libsbml.parseFormula("a+b")); InitialAssignment ia1 = new InitialAssignment(2, 2); ia1.setSymbol("ia"); ia1.setMath(libsbml.parseFormula("a+b")); int i = m.addInitialAssignment(ia); assertTrue(i == libsbml.LIBSBML_OPERATION_SUCCESS); assertTrue(m.getNumInitialAssignments() == 1); i = m.addInitialAssignment(ia1); assertTrue(i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID); assertTrue(m.getNumInitialAssignments() == 1); ia = null; ia1 = null; m = null; }
public static void Main(string[] args) { ArraysPkgNamespaces arraysNs = new ArraysPkgNamespaces(); SBMLDocument doc = new SBMLDocument(arraysNs); doc.setPackageRequired("arrays", true); Model model = doc.createModel(); // create parameters Parameter param = model.createParameter(); param.setId("n"); param.setValue(10); param.setConstant(true); param = model.createParameter(); param.setId("m"); param.setValue(10); param.setConstant(true); param = model.createParameter(); param.setId("x"); param.setValue(5.7); param.setConstant(true); ArraysSBasePlugin paramPlugin = (ArraysSBasePlugin)param.getPlugin("arrays"); Dimension dim = paramPlugin.createDimension(); dim.setId("i"); dim.setSize("n"); param = model.createParameter(); param.setId("y"); param.setConstant(false); paramPlugin = (ArraysSBasePlugin)param.getPlugin("arrays"); dim = paramPlugin.createDimension(); dim.setId("i"); dim.setSize("n"); param = model.createParameter(); param.setId("z"); param.setConstant(false); paramPlugin = (ArraysSBasePlugin)param.getPlugin("arrays"); dim = paramPlugin.createDimension(); dim.setId("i"); dim.setSize("n"); // create initial assignments InitialAssignment assignment = model.createInitialAssignment(); assignment.setSymbol("y"); ASTNode ast = new ASTNode(libsbml.AST_REAL); ast.setValue(3.2); assignment.setMath(ast); assignment = model.createInitialAssignment(); assignment.setSymbol("z"); ast = new ASTNode(libsbml.AST_REAL); ast.setValue(5.7); assignment.setMath(ast); ArraysSBasePlugin assignmentPlugin = (ArraysSBasePlugin)assignment.getPlugin("arrays"); dim = assignmentPlugin.createDimension(); dim.setId("i"); dim.setSize("m"); Index index = assignmentPlugin.createIndex(); ASTNode newAst = new ASTNode(libsbml.AST_FUNCTION); newAst.setName("selector"); ASTNode ci = new ASTNode(libsbml.AST_NAME); ci.setName("z"); newAst.addChild(ci); ci = new ASTNode(libsbml.AST_NAME); ci.setName("i"); newAst.addChild(ci); index.setMath(newAst); assignment = model.createInitialAssignment(); assignment.setSymbol("z"); ast = new ASTNode(libsbml.AST_REAL); ast.setValue(3.2); assignment.setMath(ast); assignmentPlugin = (ArraysSBasePlugin)assignment.getPlugin("arrays"); dim = assignmentPlugin.createDimension(); dim.setId("i"); dim.setSize("m"); index = assignmentPlugin.createIndex(); newAst = new ASTNode(libsbml.AST_LINEAR_ALGEBRA_SELECTOR); ci = new ASTNode(libsbml.AST_NAME); ci.setName("z"); newAst.addChild(ci); ASTNode plus = new ASTNode(libsbml.AST_PLUS); ci = new ASTNode(libsbml.AST_NAME); ci.setName("i"); plus.addChild(ci); ci = new ASTNode(libsbml.AST_NAME); ci.setName("m"); plus.addChild(ci); newAst.addChild(plus); index.setMath(newAst); libsbml.writeSBMLToFile(doc, "arrays2.xml"); }