本文整理汇总了C#中libsbmlcs.UnitDefinition类的典型用法代码示例。如果您正苦于以下问题:C# UnitDefinition类的具体用法?C# UnitDefinition怎么用?C# UnitDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnitDefinition类属于libsbmlcs命名空间,在下文中一共展示了UnitDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: setUp
public void setUp()
{
UD = new UnitDefinition(2,4);
if (UD == null);
{
}
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:7,代码来源:TestUnitDefinition.cs
示例2: test_UnitDefinition_addUnit2
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;
}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:11,代码来源:TestUnitDefinition_newSetters.cs
示例3: test_UnitDefinition_addUnit1
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;
}
开发者ID:0u812,项目名称:roadrunner-backup,代码行数:13,代码来源:TestUnitDefinition_newSetters.cs
示例4: getCPtrAndDisown
internal static HandleRef getCPtrAndDisown(UnitDefinition obj)
{
HandleRef ptr = new HandleRef(null, IntPtr.Zero);
if (obj != null)
{
ptr = obj.swigCPtr;
obj.swigCMemOwn = false;
}
return ptr;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:12,代码来源:UnitDefinition.cs
示例5: UnitDefinition
/**
* 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();
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:13,代码来源:UnitDefinition.cs
示例6: test_UnitDefinition_L1
public void test_UnitDefinition_L1()
{
UnitDefinition ud = new UnitDefinition(1,2);
assertEquals( true, ud.hasRequiredElements() );
ud = null;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:6,代码来源:TestRequiredElements.cs
示例7: test_Unit_ancestor_add
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;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:16,代码来源:TestAncestor.cs
示例8: addUnitDefinition
/**
* 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 [email protected]
* @li @link libsbml#LIBSBML_LEVEL_MISMATCH [email protected]
* @li @link libsbml#LIBSBML_VERSION_MISMATCH [email protected]
* @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID [email protected]
* @li @link libsbml#LIBSBML_INVALID_OBJECT [email protected]
* @li @link libsbml#LIBSBML_OPERATION_FAILED [email protected]
*
*
* @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;
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:38,代码来源:Model.cs
示例9: test_UnitDefinition_printUnits
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 ));
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:23,代码来源:TestUnitDefinition.cs
示例10: convertToSI
/**
* 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;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:21,代码来源:UnitDefinition.cs
示例11: test_Unit_parent_create
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;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:11,代码来源:TestSBMLParentObject.cs
示例12: test_UnitDefinition_isVariantOfSubstancePerTime_4
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;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:30,代码来源:TestUnitDefinition.cs
示例13: test_Unit_parent_add
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;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:13,代码来源:TestSBMLParentObject.cs
示例14: test_UnitDefinition_parent_add
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() );
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:12,代码来源:TestSBMLParentObject.cs
示例15: test_Unit_ancestor_create
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;
}
开发者ID:alexholehouse,项目名称:SBMLIntegrator,代码行数:17,代码来源:TestAncestor.cs
示例16: areIdentical
/**
* 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 [email protected]).
* 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;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:32,代码来源:UnitDefinition.cs
示例17: printUnits
/**
* Expresses the given definition in a plain-text form.
*
* For example,
* UnitDefinition::printUnits(@if java UnitDefinition [email protected])
* 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;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:39,代码来源:UnitDefinition.cs
示例18: combine
/**
* 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;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:25,代码来源:UnitDefinition.cs
示例19: reorder
/**
* 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));
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:16,代码来源:UnitDefinition.cs
示例20: divide
/**
* 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;
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:26,代码来源:UnitDefinition.cs
注:本文中的libsbmlcs.UnitDefinition类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论