public void setUp() { FD = new FunctionDefinition(2,4); if (FD == null); { } }
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; }
internal static HandleRef getCPtr(FunctionDefinition obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }
public void tearDown() { E = null; }
public void test_WriteSBML_FunctionDefinition_withSBO() { string expected = "<functionDefinition id=\"pow3\" sboTerm=\"SBO:0000064\">\n" + " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" + " <lambda>\n" + " <bvar>\n" + " <ci> x </ci>\n" + " </bvar>\n" + " <apply>\n" + " <power/>\n" + " <ci> x </ci>\n" + " <cn type=\"integer\"> 3 </cn>\n" + " </apply>\n" + " </lambda>\n" + " </math>\n" + "</functionDefinition>"; FunctionDefinition fd = new FunctionDefinition ( 2,4 ); fd.setId("pow3"); fd.setMath(libsbml.parseFormula("lambda(x, x^3)")); fd.setSBOTerm(64); assertEquals( true, equals(expected,fd.toSBML()) ); }
internal static HandleRef getCPtr(FunctionDefinition obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public void test_FunctionDefinition() { FunctionDefinition fd = new FunctionDefinition(2,4); assertEquals( false, (fd.hasRequiredAttributes()) ); fd.setId("fd"); assertEquals( true, fd.hasRequiredAttributes() ); fd = null; }
/** * Expands the math represented by the ASTNode to implement the functionality * of the FunctionDefinition, if it occurs within the original * math. * * For example, an ASTNode represents the math expression: f(s, p) where * f is the id of a FunctionDefinition representing f(x, y) = x * y. * The outcome of the function is that the ASTNode now represents * the math expression: s * p * * @param math ASTNode representing the math to be transformed * * @param fd the FunctionDefinition to be expanded * * @param idsToExclude an optional list of function definition ids to exclude. * * * * @if python @note Because this is a static method on a class, the Python * language interface for libSBML will contain two variants. One will be the * expected, normal static method on the class (i.e., a regular * <em>methodName</em>), and the other will be a standalone top-level * function with the name <em>ClassName_methodName()</em>. This is merely an * artifact of how the language interfaces are created in libSBML. The * methods are functionally identical. @endif * * */ /* libsbml-internal */ public static void replaceFD(ASTNode math, FunctionDefinition fd) { libsbmlPINVOKE.SBMLTransforms_replaceFD__SWIG_1(ASTNode.getCPtr(math), FunctionDefinition.getCPtr(fd)); }
public void test_Model_addFunctionDefinition4() { Model m = new Model(2,2); FunctionDefinition fd = new FunctionDefinition(2,2); fd.setId( "fd"); fd.setMath(libsbml.parseFormula("fd")); FunctionDefinition fd1 = new FunctionDefinition(2,2); fd1.setId( "fd"); fd1.setMath(libsbml.parseFormula("fd")); int i = m.addFunctionDefinition(fd); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumFunctionDefinitions() == 1 ); i = m.addFunctionDefinition(fd1); assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID ); assertTrue( m.getNumFunctionDefinitions() == 1 ); fd = null; fd1 = null; m = null; }
public void tearDown() { FD = null; }
public void test_FunctionDefinition_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2,1); sbmlns.addNamespaces(xmlns); FunctionDefinition object1 = new FunctionDefinition(sbmlns); assertTrue( object1.getTypeCode() == libsbml.SBML_FUNCTION_DEFINITION ); assertTrue( object1.getMetaId() == "" ); assertTrue( object1.getNotes() == null ); assertTrue( object1.getAnnotation() == null ); assertTrue( object1.getLevel() == 2 ); assertTrue( object1.getVersion() == 1 ); assertTrue( object1.getNamespaces() != null ); assertTrue( object1.getNamespaces().getLength() == 2 ); object1 = null; }
public void test_Model_getFunctionDefinitionById() { FunctionDefinition fd1 = new FunctionDefinition(2,4); FunctionDefinition fd2 = new FunctionDefinition(2,4); fd1.setId( "sin" ); fd2.setId( "cos" ); fd1.setMath(libsbml.parseFormula("2")); fd2.setMath(libsbml.parseFormula("2")); M.addFunctionDefinition(fd1); M.addFunctionDefinition(fd2); assertTrue( M.getNumFunctionDefinitions() == 2 ); assertNotEquals(M.getFunctionDefinition( "sin" ),fd1); assertNotEquals(M.getFunctionDefinition( "cos" ),fd2); assertEquals(M.getFunctionDefinition( "tan" ),null); }
public void test_FunctionDefinition() { FunctionDefinition fd = new FunctionDefinition(2,4); assertEquals( false, (fd.hasRequiredElements()) ); fd.setMath(libsbml.parseFormula("fd")); assertEquals( true, fd.hasRequiredElements() ); fd = null; }
public void test_Model_add_get_FunctionDefinitions() { FunctionDefinition fd1 = new FunctionDefinition(2,4); FunctionDefinition fd2 = new FunctionDefinition(2,4); fd1.setId( "fd1"); fd2.setId( "fd2"); fd1.setMath(libsbml.parseFormula("2")); fd2.setMath(libsbml.parseFormula("2")); M.addFunctionDefinition(fd1); M.addFunctionDefinition(fd2); assertTrue( M.getNumFunctionDefinitions() == 2 ); assertNotEquals(M.getFunctionDefinition(0),fd1); assertNotEquals(M.getFunctionDefinition(1),fd2); assertEquals(M.getFunctionDefinition(2),null); }
public void test_FunctionDefinition_constructor() { SBase s; try { s = new FunctionDefinition(2,1); s = new FunctionDefinition(2,2); s = new FunctionDefinition(2,3); s = new FunctionDefinition(2,4); s = new FunctionDefinition(SN21); s = new FunctionDefinition(SN22); s = new FunctionDefinition(SN23); s = new FunctionDefinition(SN24); } catch (SBMLConstructorException e) { s = null; } assertTrue(s != null); string msg = ""; try { s = new FunctionDefinition(1,1); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new FunctionDefinition(1,2); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new FunctionDefinition(SN11); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); msg = ""; try { s = new FunctionDefinition(SN12); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); try { s = new FunctionDefinition(99,99); } catch (SBMLConstructorException e) { msg = e.Message; } assertTrue(msg == ErrMsg); }
static void replaceFD(ASTNode math, FunctionDefinition fd) { libsbmlPINVOKE.SBMLTransforms_replaceFD__SWIG_1(ASTNode.getCPtr(math), FunctionDefinition.getCPtr(fd)); }
static void replaceFD(ASTNode math, FunctionDefinition fd, IdList idsToExclude) { libsbmlPINVOKE.SBMLTransforms_replaceFD__SWIG_0(ASTNode.getCPtr(math), FunctionDefinition.getCPtr(fd), IdList.getCPtr(idsToExclude)); }
public void test_FunctionDefinition_parent_add() { FunctionDefinition fd = new FunctionDefinition(2,4); Model m = new Model(2,4); fd.setId("fd"); fd.setMath(libsbml.parseFormula("l")); m.addFunctionDefinition(fd); fd = null; ListOf lo = m.getListOfFunctionDefinitions(); assertTrue( lo == m.getFunctionDefinition(0).getParentSBMLObject() ); assertTrue( m == lo.getParentSBMLObject() ); }
FunctionDefinition(FunctionDefinition orig) : this(libsbmlPINVOKE.new_FunctionDefinition__SWIG_2(FunctionDefinition.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) { throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); } }
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; }
/** * Expands the math represented by the ASTNode to implement the functionality * of the FunctionDefinition, if it occurs within the original * math. * * For example, an ASTNode represents the math expression: f(s, p) where * f is the id of a FunctionDefinition representing f(x, y) = x * y. * The outcome of the function is that the ASTNode now represents * the math expression: s * p * * @param math ASTNode representing the math to be transformed * * @param fd the FunctionDefinition to be expanded * * @param idsToExclude an optional list of function definition ids to exclude. * * * * @if python @note Because this is a static method on a class, the Python * language interface for libSBML will contain two variants. One will be the * expected, normal static method on the class (i.e., a regular * <em>methodName</em>), and the other will be a standalone top-level * function with the name <em>ClassName_methodName()</em>. This is merely an * artifact of how the language interfaces are created in libSBML. The * methods are functionally identical. @endif * * */ /* libsbml-internal */ public static void replaceFD(ASTNode math, FunctionDefinition fd, IdList idsToExclude) { libsbmlPINVOKE.SBMLTransforms_replaceFD__SWIG_0(ASTNode.getCPtr(math), FunctionDefinition.getCPtr(fd), IdList.getCPtr(idsToExclude)); }
/** * Adds a copy of the given FunctionDefinition object to this Model. * * @param fd the FunctionDefinition to add * * @return integer value indicating success/failure of the * function. The possible values * returned by this function are: * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS @endlink * @li @link libsbmlcs.libsbml.LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH @endlink * @li @link libsbmlcs.libsbml.LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH @endlink * @li @link libsbmlcs.libsbml.LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID @endlink * @li @link libsbmlcs.libsbml.LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT @endlink * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED @endlink * * * * @note This method should be used with some caution. The fact that this * method @em copies the object passed to it means that the caller will be * left holding a physically different object instance than the one contained * inside this object. Changes made to the original object instance (such as * resetting attribute values) will <em>not affect the instance in this * object</em>. In addition, the caller should make sure to free the * original object if it is no longer being used, or else a memory leak will * result. Please see other methods on this class (particularly a * corresponding method whose name begins with the word <code>create</code>) * for alternatives that do not lead to these issues. * * * * @see createFunctionDefinition() */ public int addFunctionDefinition(FunctionDefinition fd) { int ret = libsbmlPINVOKE.Model_addFunctionDefinition(swigCPtr, FunctionDefinition.getCPtr(fd)); return ret; }
public void test_Model_addFunctionDefinition2() { Model m = new Model(2,2); FunctionDefinition fd = new FunctionDefinition(2,1); fd.setId( "fd"); fd.setMath(libsbml.parseFormula("fd")); int i = m.addFunctionDefinition(fd); assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH ); assertTrue( m.getNumFunctionDefinitions() == 0 ); fd = null; m = null; }
public void test_internal_consistency_check_99911_fd() { SBMLDocument d = new SBMLDocument(2,4); long errors; Model m = d.createModel(); FunctionDefinition fd = new FunctionDefinition(2,4); d.setLevelAndVersion(2,1,false); fd.setId("fd"); fd.setSBOTerm(2); m.addFunctionDefinition(fd); errors = d.checkInternalConsistency(); assertTrue( errors == 0 ); d = null; }
/** * Copy constructor; creates a copy of this FunctionDefinition. * * @param orig the object to copy. * * @throws SBMLConstructorException * Thrown if the argument @p orig is @c null. */ public FunctionDefinition(FunctionDefinition orig) : this(libsbmlPINVOKE.new_FunctionDefinition__SWIG_2(FunctionDefinition.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); }
public void test_internal_consistency_check_99912() { SBMLDocument d = new SBMLDocument(2,4); long errors; FunctionDefinition fd = new FunctionDefinition(2,4); Model m = d.createModel(); d.setLevelAndVersion(1,2,false); Compartment c = m.createCompartment(); c.setId("cc"); c.setConstant(false); m.addFunctionDefinition(fd); errors = d.checkInternalConsistency(); assertTrue( errors == 0 ); d = null; }
internal static HandleRef getCPtrAndDisown(FunctionDefinition obj) { HandleRef ptr = new HandleRef(null, IntPtr.Zero); if (obj != null) { ptr = obj.swigCPtr; obj.swigCMemOwn = false; } return ptr; }
public void test_FunctionDefinition_ancestor_add() { FunctionDefinition fd = new FunctionDefinition(2,4); Model m = new Model(2,4); fd.setId("fd"); fd.setMath(libsbml.parseFormula("l")); m.addFunctionDefinition(fd); fd = null; ListOf lo = m.getListOfFunctionDefinitions(); FunctionDefinition obj = m.getFunctionDefinition(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 ); }