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;
 }
Esempio n. 4
0
 /**
    * Alphabetically orders the Unit objects within the ListOfUnits of a
    * UnitDefinition.
    *
    * @param ud the UnitDefinition object whose units are to be reordered.
    *
    * @if notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_reorder(). They are functionally identical. @endif
    */
 public static void reorder(UnitDefinition ud)
 {
     libsbmlPINVOKE.UnitDefinition_reorder(UnitDefinition.getCPtr(ud));
 }
Esempio n. 5
0
 /**
    * Expresses the given definition in a plain-text form.
    *
    * For example,
    * UnitDefinition::printUnits(@if java UnitDefinition u@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 bool 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 notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_printUnits(). They 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;
 }
Esempio n. 6
0
 /**
    * 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 notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_convertToSI(). They 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;
 }
Esempio n. 7
0
 /**
    * 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 u1, %Unit u2@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 notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_areIdentical(). They 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;
 }
Esempio n. 8
0
        internal static HandleRef getCPtrAndDisown(UnitDefinition obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
Esempio n. 9
0
        static string printUnits(UnitDefinition ud, bool compact)
        {
            string ret = libsbmlPINVOKE.UnitDefinition_printUnits__SWIG_0(UnitDefinition.getCPtr(ud), compact);

            return(ret);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 static void simplify(UnitDefinition ud)
 {
     libsbmlPINVOKE.UnitDefinition_simplify(UnitDefinition.getCPtr(ud));
 }
Esempio n. 12
0
 static void reorder(UnitDefinition ud)
 {
     libsbmlPINVOKE.UnitDefinition_reorder(UnitDefinition.getCPtr(ud));
 }
Esempio n. 13
0
 UnitDefinition(UnitDefinition orig) : this(libsbmlPINVOKE.new_UnitDefinition__SWIG_2(UnitDefinition.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 14
0
 internal static HandleRef getCPtr(UnitDefinition obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Esempio n. 15
0
        static string printUnits(UnitDefinition ud)
        {
            string ret = libsbmlPINVOKE.UnitDefinition_printUnits__SWIG_1(UnitDefinition.getCPtr(ud));

            return(ret);
        }
Esempio n. 16
0
 /**
    * 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.  @if clike The value is drawn from the
  * enumeration #OperationReturnValues_t. @endif The possible values
  * returned by this function are:
  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink
    * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink
    * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    * @li @link 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 tearDown()
 {
     UD = null;
 }
 public void test_UnitDefinition_L1()
 {
     UnitDefinition ud = new UnitDefinition(1,2);
       assertEquals( true, ud.hasRequiredElements() );
       ud = null;
 }
 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;
 }
Esempio n. 20
0
 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;
 }
Esempio n. 21
0
        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);
        }
 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;
 }
Esempio n. 23
0
 public void test_UnitDefinition_ancestor_add()
 {
     UnitDefinition ia = new UnitDefinition(2,4);
       Model m = new Model(2,4);
       ia.setId("u");
       ia.createUnit();
       m.addUnitDefinition(ia);
       ia = null;
       ListOf lo = m.getListOfUnitDefinitions();
       UnitDefinition obj = m.getUnitDefinition(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 );
 }
Esempio n. 24
0
 internal static HandleRef getCPtr(UnitDefinition obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Esempio n. 25
0
 public void test_Unit_ancestor_add()
 {
     UnitDefinition ud = new UnitDefinition(2,4);
       Unit u = new Unit(2,4);
       u.setKind(libsbml.UNIT_KIND_MOLE);
       ud.addUnit(u);
       u = null;
       assertTrue( ud.getNumUnits() == 1 );
       ListOf lo = ud.getListOfUnits();
       Unit obj = ud.getUnit(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == ud );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
       ud = null;
 }
Esempio n. 26
0
 /**
    * Copy constructor; creates a copy of this UnitDefinition.
    *
    * @param orig the object to copy.
    *
    * @throws @if python ValueError @else SBMLConstructorException @endif
    * Thrown if the argument @p orig is @c null.
    */
 public UnitDefinition(UnitDefinition orig)
     : this(libsbmlPINVOKE.new_UnitDefinition__SWIG_2(UnitDefinition.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
Esempio n. 27
0
 public void test_Unit_ancestor_create()
 {
     UnitDefinition ud = new UnitDefinition(2,4);
       Unit u = ud.createUnit();
       assertTrue( ud.getNumUnits() == 1 );
       ListOf lo = ud.getListOfUnits();
       assertTrue( u.getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == ud );
       assertTrue( u.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( u.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( u.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
       Unit obj = ud.getUnit(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == ud );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
       ud = null;
 }
Esempio n. 28
0
 /**
    * 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 notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_combine(). They 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_UnitDefinition_parent_add()
 {
     UnitDefinition ia = new UnitDefinition(2,4);
       Model m = new Model(2,4);
       ia.setId("u");
       ia.createUnit();
       m.addUnitDefinition(ia);
       ia = null;
       ListOf lo = m.getListOfUnitDefinitions();
       assertTrue( lo == m.getUnitDefinition(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
Esempio n. 30
0
 /**
    * 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 notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_combine(). They 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;
 }
 public void test_Unit_parent_add()
 {
     UnitDefinition ud = new UnitDefinition(2,4);
       Unit u = new Unit(2,4);
       u.setKind(libsbml.UNIT_KIND_MOLE);
       ud.addUnit(u);
       u = null;
       assertTrue( ud.getNumUnits() == 1 );
       ListOf lo = ud.getListOfUnits();
       assertTrue( lo == ud.getUnit(0).getParentSBMLObject() );
       assertTrue( ud == lo.getParentSBMLObject() );
       ud = null;
 }
Esempio n. 32
0
 /**
    * Expresses the given definition in a plain-text form.
    *
    * For example,
    * UnitDefinition::printUnits(@if java UnitDefinition u@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 bool 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 notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_printUnits(). They 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_Unit_parent_create()
 {
     UnitDefinition ud = new UnitDefinition(2,4);
       Unit u = ud.createUnit();
       assertTrue( ud.getNumUnits() == 1 );
       ListOf lo = ud.getListOfUnits();
       assertTrue( lo == ud.getUnit(0).getParentSBMLObject() );
       assertTrue( lo == u.getParentSBMLObject() );
       assertTrue( ud == lo.getParentSBMLObject() );
       ud = null;
 }
Esempio n. 34
0
 /**
    * 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 notclike @note Because this is a @em static method, the
    * non-C++ language interfaces for libSBML will contain two variants.  One
    * will be a static method on the class (i.e., UnitDefinition), and the
    * other will be a standalone top-level function with the name
    * UnitDefinition_simplify(). They are functionally identical. @endif
    */
 public static void simplify(UnitDefinition ud)
 {
     libsbmlPINVOKE.UnitDefinition_simplify(UnitDefinition.getCPtr(ud));
 }
 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;
 }
 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_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 ));
 }
        public void test_UnitDefinition_constructor()
        {
            SBase s;

              try
              {
            s = new UnitDefinition(1,1);
            s = new UnitDefinition(1,2);
            s = new UnitDefinition(2,1);
            s = new UnitDefinition(2,2);
            s = new UnitDefinition(2,3);
            s = new UnitDefinition(2,4);
            s = new UnitDefinition(3,1);
            s = new UnitDefinition(SN11);
            s = new UnitDefinition(SN12);
            s = new UnitDefinition(SN21);
            s = new UnitDefinition(SN22);
            s = new UnitDefinition(SN23);
            s = new UnitDefinition(SN24);
            s = new UnitDefinition(SN31);
              }
              catch (SBMLConstructorException e)
              {
             s = null;
              }
              assertTrue(s != null);

              string msg = "";

              try
              {
            s = new UnitDefinition(9,9);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";

              try
              {
            s = new UnitDefinition(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
Esempio n. 39
0
        static bool areEquivalent(UnitDefinition ud1, UnitDefinition ud2)
        {
            bool ret = libsbmlPINVOKE.UnitDefinition_areEquivalent(UnitDefinition.getCPtr(ud1), UnitDefinition.getCPtr(ud2));

            return(ret);
        }