public void setUp() { UD = new UnitDefinition(2,4); if (UD == null); { } }
public void test_UnitDefinition_addUnit2() { UnitDefinition m = new UnitDefinition(2,2); Unit p = new Unit(2,1); p.setKind(libsbml.UNIT_KIND_MOLE); int i = m.addUnit(p); assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH ); assertTrue( m.getNumUnits() == 0 ); p = null; m = null; }
public void test_UnitDefinition_addUnit1() { UnitDefinition m = new UnitDefinition(2,2); Unit p = new Unit(2,2); int i = m.addUnit(p); assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT ); p.setKind(libsbml.UNIT_KIND_MOLE); i = m.addUnit(p); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumUnits() == 1 ); p = null; m = null; }
/** * Convert a given UnitDefinition into a new UnitDefinition object * that uses SI units. * * @param ud the UnitDefinition object to convert to SI * * @return a new UnitDefinition object representing the results of the * conversion. * * * @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 * * */ public static UnitDefinition convertToSI(UnitDefinition ud) { IntPtr cPtr = libsbmlPINVOKE.UnitDefinition_convertToSI(UnitDefinition.getCPtr(ud)); UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, true); return ret; }
internal static HandleRef getCPtrAndDisown(UnitDefinition obj) { HandleRef ptr = new HandleRef(null, IntPtr.Zero); if (obj != null) { ptr = obj.swigCPtr; obj.swigCMemOwn = false; } return ptr; }
/** * Predicate returning @c true if two * UnitDefinition objects are identical. * * For the purposes of performing this comparison, two UnitDefinition * objects are considered identical when they contain identical lists of * Unit objects. Pairs of Unit objects in the lists are in turn * considered identical if they satisfy the predicate * Unit::areIdentical(@if java Unit, %Unit@endif). * The predicate compares every attribute of the * Unit objects. * * @param ud1 the first UnitDefinition object to compare * @param ud2 the second UnitDefinition object to compare * * @return @c true if all the Unit objects in ud1 are identical to the * Unit objects of ud2, @c false otherwise. * * * @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 * * * * @see UnitDefinition::areEquivalent(UnitDefinition ud1, %UnitDefinition ud2) * @see Unit::areIdentical(Unit unit1, %Unit unit2) */ public static bool areIdentical(UnitDefinition ud1, UnitDefinition ud2) { bool ret = libsbmlPINVOKE.UnitDefinition_areIdentical(UnitDefinition.getCPtr(ud1), UnitDefinition.getCPtr(ud2)); return ret; }
/** * Adds a copy of the given UnitDefinition object to this Model. * * @param ud the UnitDefinition object 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 createUnitDefinition() */ public int addUnitDefinition(UnitDefinition ud) { int ret = libsbmlPINVOKE.Model_addUnitDefinition(swigCPtr, UnitDefinition.getCPtr(ud)); return ret; }
public void test_internal_consistency_check_99905_unitdef() { SBMLDocument d = new SBMLDocument(2,4); long errors; UnitDefinition u = new UnitDefinition(2,4); d.setLevelAndVersion(2,2,false); Model m = d.createModel(); u.setId("ud"); u.setSBOTerm(9); u.createUnit(); m.addUnitDefinition(u); errors = d.checkInternalConsistency(); assertTrue( errors == 0 ); d = null; }
static void simplify(UnitDefinition ud) { libsbmlPINVOKE.UnitDefinition_simplify(UnitDefinition.getCPtr(ud)); }
public void test_UnitDefinition_assignmentOperator() { UnitDefinition o1 = new UnitDefinition(2,4); o1.setId("c"); assertTrue( o1.getId() == "c" ); UnitDefinition o2 = new UnitDefinition(2,4); o2 = o1; assertTrue( o2.getId() == "c" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
static string printUnits(UnitDefinition ud) { string ret = libsbmlPINVOKE.UnitDefinition_printUnits__SWIG_1(UnitDefinition.getCPtr(ud)); return(ret); }
internal static HandleRef getCPtr(UnitDefinition obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }
static UnitDefinition divide(UnitDefinition ud1, UnitDefinition ud2) { IntPtr cPtr = libsbmlPINVOKE.UnitDefinition_divide(UnitDefinition.getCPtr(ud1), UnitDefinition.getCPtr(ud2)); UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, false); return(ret); }
static string printUnits(UnitDefinition ud, bool compact) { string ret = libsbmlPINVOKE.UnitDefinition_printUnits__SWIG_0(UnitDefinition.getCPtr(ud), compact); return(ret); }
static UnitDefinition combine(UnitDefinition ud1, UnitDefinition ud2) { IntPtr cPtr = libsbmlPINVOKE.UnitDefinition_combine(UnitDefinition.getCPtr(ud1), UnitDefinition.getCPtr(ud2)); UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, true); return(ret); }
static bool areEquivalent(UnitDefinition ud1, UnitDefinition ud2) { bool ret = libsbmlPINVOKE.UnitDefinition_areEquivalent(UnitDefinition.getCPtr(ud1), UnitDefinition.getCPtr(ud2)); return(ret); }
static void reorder(UnitDefinition ud) { libsbmlPINVOKE.UnitDefinition_reorder(UnitDefinition.getCPtr(ud)); }
/** * Expresses the given definition in a plain-text form. * * For example, * UnitDefinition::printUnits(@if java UnitDefinition@endif) * applied to * @verbatim <unitDefinition> <listOfUnits> <unit kind='metre' exponent='1'/> <unit kind='second' exponent='-2'/> </listOfUnits> <unitDefinition> @endverbatim * will return the string <code>'metre (exponent = 1, multiplier = 1, * scale = 0) second (exponent = -2, multiplier = 1, scale = 0)'</code> * or, if the optional parameter @p compact is given the value @c true, * the string <code>'(1 metre)^1 (1 second)^-2'</code>. This method may * be useful for printing unit information to human users, or in * debugging software, or other situations. * * @param ud the UnitDefinition object * @param compact boolean indicating whether the compact form * should be used (defaults to false) * * @return a string expressing the unit definition defined by the given * UnitDefinition object @p ud. * * * @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 * * */ public static string printUnits(UnitDefinition ud, bool compact) { string ret = libsbmlPINVOKE.UnitDefinition_printUnits__SWIG_0(UnitDefinition.getCPtr(ud), compact); return ret; }
UnitDefinition(UnitDefinition orig) : this(libsbmlPINVOKE.new_UnitDefinition__SWIG_2(UnitDefinition.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) { throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); } }
/** * Alphabetically orders the Unit objects within the ListOfUnits of a * UnitDefinition. * * @param ud the UnitDefinition object whose units are to be reordered. * * * @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 * * */ public static void reorder(UnitDefinition ud) { libsbmlPINVOKE.UnitDefinition_reorder(UnitDefinition.getCPtr(ud)); }
public void test_Model_getUnitDefinition() { UnitDefinition ud1 = new UnitDefinition(2,4); UnitDefinition ud2 = new UnitDefinition(2,4); ud1.setId( "mmls" ); ud2.setId( "volume" ); ud1.createUnit(); ud2.createUnit(); M.addUnitDefinition(ud1); M.addUnitDefinition(ud2); assertTrue( M.getNumUnitDefinitions() == 2 ); ud1 = M.getUnitDefinition(0); ud2 = M.getUnitDefinition(1); assertTrue(( "mmls" == ud1.getId() )); assertTrue(( "volume" == ud2.getId() )); }
public void test_UnitDefinition_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(2,1); sbmlns.addNamespaces(xmlns); UnitDefinition object1 = new UnitDefinition(sbmlns); assertTrue( object1.getTypeCode() == libsbml.SBML_UNIT_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_getUnitDefinitionById() { UnitDefinition ud1 = new UnitDefinition(2,4); UnitDefinition ud2 = new UnitDefinition(2,4); ud1.setId( "mmls" ); ud2.setId( "volume" ); ud1.createUnit(); ud2.createUnit(); M.addUnitDefinition(ud1); M.addUnitDefinition(ud2); assertTrue( M.getNumUnitDefinitions() == 2 ); assertNotEquals(M.getUnitDefinition( "mmls" ),ud1); assertNotEquals(M.getUnitDefinition( "volume" ),ud2); assertEquals(M.getUnitDefinition( "rototillers"),null); }
public void test_UnitDefinition_copyConstructor() { UnitDefinition o1 = new UnitDefinition(2,4); o1.setId("c"); assertTrue( o1.getId() == "c" ); UnitDefinition o2 = new UnitDefinition(o1); assertTrue( o2.getId() == "c" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_UnitDefinition() { UnitDefinition ud = new UnitDefinition(2,4); assertEquals( false, (ud.hasRequiredElements()) ); ud.createUnit(); assertEquals( true, ud.hasRequiredElements() ); ud = null; }
public void test_internal_consistency_check_99904_unitdef() { SBMLDocument d = new SBMLDocument(2,4); long errors; UnitDefinition u = new UnitDefinition(2,4); d.setLevelAndVersion(1,2,false); Model m = d.createModel(); Compartment c = m.createCompartment(); c.setId("cc"); u.setId("ud"); u.setMetaId("mmm"); u.createUnit(); m.addUnitDefinition(u); errors = d.checkInternalConsistency(); assertTrue( errors == 0 ); d = null; }
public void test_UnitDefinition_L1() { UnitDefinition ud = new UnitDefinition(1,2); assertEquals( true, ud.hasRequiredElements() ); ud = null; }
internal static HandleRef getCPtr(UnitDefinition obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public void test_UnitDefinition_isVariantOfSubstancePerTime_4() { UnitDefinition ud = new UnitDefinition(2,2); Unit dim = ud.createUnit(); dim.setKind(libsbml.UnitKind_forName("dimensionless")); Unit perTime = ud.createUnit(); perTime.setKind(libsbml.UnitKind_forName("second")); perTime.setExponent(-1); Unit u = ud.createUnit(); assertEquals( false, ud.isVariantOfSubstancePerTime() ); u.setKind(libsbml.UNIT_KIND_KILOGRAM); u.setExponent(1); assertEquals( true, ud.isVariantOfSubstancePerTime() ); u.setScale(-1); perTime.setScale(-1); assertEquals( true, ud.isVariantOfSubstancePerTime() ); u.setMultiplier(2); assertEquals( true, ud.isVariantOfSubstancePerTime() ); u.setOffset(3); assertEquals( true, ud.isVariantOfSubstancePerTime() ); u.setExponent(-3); assertEquals( false, ud.isVariantOfSubstancePerTime() ); u.setExponent(1); perTime.setExponent(-3); assertEquals( false, ud.isVariantOfSubstancePerTime() ); perTime.setExponent(-1); ud.addUnit(dim); assertEquals( true, ud.isVariantOfSubstancePerTime() ); ud = null; }
/** * Copy constructor; creates a copy of this UnitDefinition. * * @param orig the object to copy. */ public UnitDefinition(UnitDefinition orig) : this(libsbmlPINVOKE.new_UnitDefinition__SWIG_2(UnitDefinition.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); }
public void test_UnitDefinition_printUnits() { UnitDefinition ud = new UnitDefinition(2,4); ud.setId( "mmls"); Unit perTime = ud.createUnit(); perTime.setKind(libsbml.UnitKind_forName("second")); perTime.setExponent(-1); string ud_str = UnitDefinition.printUnits(ud,false); assertTrue(( "second (exponent = -1, multiplier = 1, scale = 0)" == ud_str )); string ud_str1 = UnitDefinition.printUnits(ud,true); assertTrue(( "(1 second)^-1" == ud_str1 )); UnitDefinition ud1 = new UnitDefinition(2,4); ud1.setId( "mmls"); Unit u = ud1.createUnit(); u.setKind(libsbml.UNIT_KIND_KILOGRAM); u.setExponent(1); u.setScale(2); u.setMultiplier(3.0); string ud_str2 = UnitDefinition.printUnits(ud1,false); assertTrue(( "kilogram (exponent = 1, multiplier = 3, scale = 2)" == ud_str2 )); string ud_str3 = UnitDefinition.printUnits(ud1,true); assertTrue(( "(300 kilogram)^1" == ud_str3 )); }
/** * Combines two UnitDefinition objects into a single UnitDefinition. * * This takes UnitDefinition objects @p ud1 and @p ud2, and creates a * UnitDefinition object that expresses the product of the units of @p * ud1 and @p ud2. * * @param ud1 the first UnitDefinition object * @param ud2 the second UnitDefinition object * * @return a UnitDefinition which represents the product of the * units of the two argument UnitDefinitions. * * * @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 * * */ public static UnitDefinition combine(UnitDefinition ud1, UnitDefinition ud2) { IntPtr cPtr = libsbmlPINVOKE.UnitDefinition_combine(UnitDefinition.getCPtr(ud1), UnitDefinition.getCPtr(ud2)); UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, true); return ret; }
public void test_Model_addUnitDefinition3() { Model m = new Model(2,2); UnitDefinition ud = new UnitDefinition(1,2); ud.createUnit(); ud.setId( "ud"); int i = m.addUnitDefinition(ud); assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH ); assertTrue( m.getNumUnitDefinitions() == 0 ); ud = null; m = null; }
/** * Combines two UnitDefinition objects into a single UnitDefinition as * a division. * * This takes UnitDefinition objects @p ud1 and @p ud2, and creates a * UnitDefinition object that expresses the division of the units of @p * ud1 and @p ud2. * * @param ud1 the first UnitDefinition object * @param ud2 the second UnitDefinition object * * @return a UnitDefinition which represents the division of the * units of the two argument UnitDefinitions. * * * @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 * * */ public static UnitDefinition divide(UnitDefinition ud1, UnitDefinition ud2) { IntPtr cPtr = libsbmlPINVOKE.UnitDefinition_divide(UnitDefinition.getCPtr(ud1), UnitDefinition.getCPtr(ud2)); UnitDefinition ret = (cPtr == IntPtr.Zero) ? null : new UnitDefinition(cPtr, false); return ret; }
UnitDefinition get(string sid) { global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfUnitDefinitions_get__SWIG_2(swigCPtr, sid); UnitDefinition ret = (cPtr == global::System.IntPtr.Zero) ? null : new UnitDefinition(cPtr, false); return ret; }
/** * Expresses the given definition in a plain-text form. * * For example, * UnitDefinition::printUnits(@if java UnitDefinition@endif) * applied to * @verbatim <unitDefinition> <listOfUnits> <unit kind='metre' exponent='1'/> <unit kind='second' exponent='-2'/> </listOfUnits> <unitDefinition> @endverbatim * will return the string <code>'metre (exponent = 1, multiplier = 1, * scale = 0) second (exponent = -2, multiplier = 1, scale = 0)'</code> * or, if the optional parameter @p compact is given the value @c true, * the string <code>'(1 metre)^1 (1 second)^-2'</code>. This method may * be useful for printing unit information to human users, or in * debugging software, or other situations. * * @param ud the UnitDefinition object * @param compact boolean indicating whether the compact form * should be used (defaults to false) * * @return a string expressing the unit definition defined by the given * UnitDefinition object @p ud. * * * @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 * * */ public static string printUnits(UnitDefinition ud) { string ret = libsbmlPINVOKE.UnitDefinition_printUnits__SWIG_1(UnitDefinition.getCPtr(ud)); return ret; }
public void test_UnitDefinition_createWithName() { UnitDefinition ud = new UnitDefinition(2,4); ud.setName( "mmol_per_liter_per_sec"); assertTrue( ud.getTypeCode() == libsbml.SBML_UNIT_DEFINITION ); assertTrue( ud.getMetaId() == "" ); assertTrue( ud.getNotes() == null ); assertTrue( ud.getAnnotation() == null ); assertTrue( ud.getId() == "" ); assertTrue(( "mmol_per_liter_per_sec" == ud.getName() )); assertEquals( true, ud.isSetName() ); assertTrue( ud.getNumUnits() == 0 ); ud = null; }
/** * Simplifies the UnitDefinition such that any given kind of Unit object * occurs only once in the ListOfUnits. * * For example, the following definition, * @verbatim <unitDefinition> <listOfUnits> <unit kind='metre' exponent='1'/> <unit kind='metre' exponent='2'/> </listOfUnits> <unitDefinition> @endverbatim * will be simplified to * @verbatim <unitDefinition> <listOfUnits> <unit kind='metre' exponent='3'/> </listOfUnits> <unitDefinition> @endverbatim * * @param ud the UnitDefinition object to be simplified. * * * @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 * * */ public static void simplify(UnitDefinition ud) { libsbmlPINVOKE.UnitDefinition_simplify(UnitDefinition.getCPtr(ud)); }
UnitDefinition remove(string sid) { global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfUnitDefinitions_remove__SWIG_1(swigCPtr, sid); UnitDefinition ret = (cPtr == global::System.IntPtr.Zero) ? null : new UnitDefinition(cPtr, true); return ret; }
public void test_Model_addUnitDefinition5() { Model m = new Model(2,2); UnitDefinition ud = new UnitDefinition(2,2); ud.setId( "ud"); ud.createUnit(); UnitDefinition ud1 = new UnitDefinition(2,2); ud1.setId( "ud"); ud1.createUnit(); int i = m.addUnitDefinition(ud); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( m.getNumUnitDefinitions() == 1 ); i = m.addUnitDefinition(ud1); assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID ); assertTrue( m.getNumUnitDefinitions() == 1 ); ud = null; ud1 = null; m = null; }
public void tearDown() { UD = null; }