1 /* ---------------------------------------------------------------------------- 2 * This file was automatically generated by SWIG (http://www.swig.org). 3 * Version 4.0.2 4 * 5 * Do not make changes to this file unless you know what you are doing--modify 6 * the SWIG interface file instead. 7 * ----------------------------------------------------------------------------- */ 8 9 package org.sbml.libsbml; 10 11 /** 12 * An assignment to a variable by an SBML <em>event</em>. 13 <p> 14 * {@link Event} contains an optional element called 'listOfEventAssignments', of 15 * class {@link ListOfEventAssignments}. In every instance of an event definition 16 * in a model, the object's 'listOfEventAssignments' element must have a 17 * non-empty list of one or more 'eventAssignment' elements of class 18 * {@link EventAssignment}. The object class {@link EventAssignment} has one required 19 * attribute, 'variable', and a required element, 'math'. Being derived 20 * from {@link SBase}, it also has all the usual attributes and elements of its 21 * parent class. 22 <p> 23 * An {@link Event} object defines when the event can occur, the variables that are 24 * affected by the event, and how the variables are affected. The purpose 25 * of the {@link EventAssignment} object class is to define how variables are 26 * affected by an {@link Event}. In SBML Level 2, every {@link Event} object instance 27 * must have a nonempty list of event assignments; in SBML Level 3, 28 * the list of assignments is optional. 29 <p> 30 * The operation of an {@link Event} is divided into two phases (regardless of 31 * whether a delay is involved): one phase when the event is <em>triggered</em>, 32 * and the other when the event is <em>executed</em>. {@link EventAssignment} objects 33 * are interpreted when an event is executed. The effects are described 34 * below. 35 <p> 36 * <h2>The attribute 'variable'</h2> 37 <p> 38 * The {@link EventAssignment} attribute 'variable' must be the identifier of an 39 * existing {@link Compartment}, {@link Species}, {@link SpeciesReference}, or {@link Parameter} 40 * instance defined in the model. In SBML Level 3 Version 2, 41 * this list was expanded to include identifiers of SBML Level 3 42 * package variables that have both mathematical meaning and the 43 * ability to be assigned. When the event is executed, the value of 44 * the model component identified by 'variable' is changed by the 45 * {@link EventAssignment} to the value computed by the 'math' element; that is, a 46 * species' quantity, species reference's stoichiometry, compartment's size 47 * or parameter's value are reset to the value computed by 'math'. 48 <p> 49 * Certain restrictions are placed on what can appear in 'variable': 50 * <ul> 51 * <li> The object identified by the value of the {@link EventAssignment} attribute 52 * 'variable' must not have its 'constant' attribute set to or default to 53 * <code>true.</code> (Constants cannot be affected by events.) 54 <p> 55 * <li> The 'variable' attribute must not contain the identifier of a 56 * reaction. In SBML Level 2 and SBML Level 3 Version 1, 57 * only species, species references, compartment and parameter 58 * values may be set by an {@link Event}. In SBML Level 3 Version 2, 59 * the 'variable' attribute may also be the identifier of an SBML 60 * Level 3 package element with mathematical meaning and the 61 * ability to be assigned a value. This situation may only arise if 62 * the SBML package is present in the SBML document with a 63 * package:required attribute of <code>true</code> 64 <p> 65 * <li> The value of every 'variable' attribute must be unique among the set 66 * of {@link EventAssignment} structures within a given {@link Event} structure. In other 67 * words, a single event cannot have multiple {@link EventAssignment} objects 68 * assigning the same variable. (All of them would be performed at the 69 * same time when that particular {@link Event} triggers, resulting in 70 * indeterminacy.) However, <em>separate</em> {@link Event} instances can refer to the 71 * same variable. 72 <p> 73 * <li> A variable cannot be assigned a value in an {@link EventAssignment} object 74 * instance and also be assigned a value by an {@link AssignmentRule}; i.e., the 75 * value of an {@link EventAssignment}'s 'variable' attribute cannot be the same as 76 * the value of a {@link AssignmentRule}' 'variable' attribute. (Assignment rules 77 * hold at all times, therefore it would be inconsistent to also define an 78 * event that reassigns the value of the same variable.) 79 * </ul> 80 <p> 81 * If the variable attribute of an {@link EventAssignment} object references an 82 * object in an SBML namespace that is not understood by the interpreter 83 * reading a given SBML document (that is, if the object is defined by an 84 * SBML Level 3 package that the software does not support), the 85 * event assignment must be ignored--the object's value will not need to 86 * be set, as the interpreter could not understand that package. If an 87 * interpreter cannot establish whether a referenced object is missing 88 * from the model or instead is defined in an SBML namespace not 89 * understood by the interpreter, it may produce a warning to the user. 90 * (The latter situation may only arise if an SBML package is present in 91 * the SBML document with a package:required attribute of 'true'.) 92 <p> 93 * Note that the time of assignment of the object identified by the 94 * value of the 'variable' attribute is always the time at which the {@link Event} 95 * is <em>executed</em>, not when it is <em>triggered</em>. The timing is 96 * controlled by the optional {@link Delay} in an {@link Event}. The time of 97 * assignment is not affected by the 'useValuesFromTriggerTime' 98 * attribute on {@link Event}—that attribute affects the time at which the 99 * {@link EventAssignment}'s 'math' expression is <em>evaluated</em>. In other 100 * words, SBML allows decoupling the time at which the 101 * 'variable' is assigned from the time at which its value 102 * expression is calculated. 103 <p> 104 * <h2>The 'math' subelement in an {@link EventAssignment}</h2> 105 <p> 106 * The MathML expression contained in an {@link EventAssignment} defines the new 107 * value of the variable being assigned by the {@link Event}. 108 <p> 109 * As mentioned above, the time at which the expression in 'math' is 110 * evaluated is determined by the attribute 'useValuesFromTriggerTime' on 111 * {@link Event}. If the attribute value is <code>true</code>, the expression must be 112 * evaluated when the event is <em>triggered</em>; more precisely, the values of 113 * identifiers occurring in MathML <code><ci></code> elements in the 114 * {@link EventAssignment}'s 'math' expression are the values they have at the 115 * point when the event <em>triggered</em>. If, instead, 116 * 'useValuesFromTriggerTime''s value is <code>false</code>, it means the values at 117 * <em>execution</em> time should be used; that is, the values of identifiers 118 * occurring in MathML <code><ci></code> elements in the 119 * {@link EventAssignment}'s 'math' expression are the values they have at the 120 * point when the event <em>executed</em>. 121 <p> 122 * <h2>SBML Level/Version differences</h2> 123 <p> 124 * Between Version 4 and previous versions of SBML Level 2, the 125 * requirements regarding the matching of units between an 126 * EvengAssignment's formula and the units of the object identified by the 127 * 'variable' attribute changed. Previous versions required consistency, 128 * but in SBML Level 2 Version 4 and in SBML Level 3, unit 129 * consistency is only <em>recommended</em>. More precisely: 130 * <ul> 131 <p> 132 * <li> In the case of a species, an {@link EventAssignment} sets the referenced 133 * species' quantity (concentration or amount of substance) to the value 134 * determined by the formula in the {@link EventAssignment}'s 'math' subelement. 135 * The units of the 'math' formula should (in SBML Level 2 136 * Version 4 and in Level 3) or must (in previous Versions of 137 * Level 2) be identical to the units of the species. 138 <p> 139 * <li> (SBML Level 3 only.) In the case of a species reference, an 140 * {@link EventAssignment} sets the stoichiometry of the reactant or product 141 * referenced by the {@link SpeciesReference} object to the value determined by the 142 * formula in the 'math' element. The unit associated with the value 143 * produced by the 'math' formula should be <code>dimensionless</code>, because 144 * reactant and product stoichiometries in reactions are dimensionless 145 * quantities. 146 <p> 147 * <li> In the case of a compartment, an {@link EventAssignment} sets the 148 * referenced compartment's size to the size determined by the formula in 149 * the 'math' subelement of the {@link EventAssignment}. The overall units of the 150 * formula should (in SBML Level 2 Version 4 and in Level 3) 151 * or must (in previous Versions of Level 2) be identical to the units 152 * specified for the size of the compartment identified by the 153 * {@link EventAssignment}'s 'variable' attribute. 154 <p> 155 * <li> In the case of a parameter, an {@link EventAssignment} sets the referenced 156 * parameter's value to that determined by the formula in 'math'. The 157 * overall units of the formula should (in SBML Level 2 Version 4 158 * and Level 3) or must (in previous Versions of Level 2) be 159 * identical to the units defined for the parameter. 160 <p> 161 * <li> (For SBML Level 3 Version 2 only) <em>In the case of 162 * an object from an SBML Level 3 package</em>, an {@link EventAssignment} sets 163 * the referenced object's value (as defined by that package) to the 164 * value of the formula in 'math'. The unit of measurement associated 165 * with the value produced by the formula should be the same as that 166 * object's units attribute value (if it has such an attribute), or be 167 * equal to the units of model components of that type (if objects of 168 * that class are defined by the package as having the same units). 169 * </ul> 170 <p> 171 * Note that the formula placed in the 'math' element <em>has no assumed 172 * units</em>. The consistency of the units of the formula, and the units 173 * of the entity which the assignment affects, must be explicitly 174 * established just as in the case of the value of the {@link Delay} subelement. 175 * An approach similar to the one discussed in the context of {@link Delay} may be 176 * used for the formula of an {@link EventAssignment}. 177 <p> 178 * <h2>Restrictions relaxed in SBML Level 3 Version 2</h2> 179 <p> 180 * In SBML Level 3 Version 2, the requirement that an {@link EventAssignment} 181 * have a 'math' subelement was relaxed, making it optional. In 182 * this case, the {@link EventAssignment} remains undefined, and unless that information 183 * is provided in some other form (such as with an SBML Level 3 184 * package), the {@link Event} behaves as if it had no {@link EventAssignment}. 185 <p> 186 * @see Event 187 */ 188 189 public class EventAssignment extends SBase { 190 private long swigCPtr; 191 EventAssignment(long cPtr, boolean cMemoryOwn)192 protected EventAssignment(long cPtr, boolean cMemoryOwn) 193 { 194 super(libsbmlJNI.EventAssignment_SWIGUpcast(cPtr), cMemoryOwn); 195 swigCPtr = cPtr; 196 } 197 getCPtr(EventAssignment obj)198 protected static long getCPtr(EventAssignment obj) 199 { 200 return (obj == null) ? 0 : obj.swigCPtr; 201 } 202 getCPtrAndDisown(EventAssignment obj)203 protected static long getCPtrAndDisown (EventAssignment obj) 204 { 205 long ptr = 0; 206 207 if (obj != null) 208 { 209 ptr = obj.swigCPtr; 210 obj.swigCMemOwn = false; 211 } 212 213 return ptr; 214 } 215 216 @SuppressWarnings("deprecation") finalize()217 protected void finalize() { 218 delete(); 219 } 220 delete()221 public synchronized void delete() { 222 if (swigCPtr != 0) { 223 if (swigCMemOwn) { 224 swigCMemOwn = false; 225 libsbmlJNI.delete_EventAssignment(swigCPtr); 226 } 227 swigCPtr = 0; 228 } 229 super.delete(); 230 } 231 232 233 /** 234 * Creates a new {@link EventAssignment} using the given SBML <code>level</code> and <code>version</code> 235 * values. 236 <p> 237 * @param level a long integer, the SBML Level to assign to this {@link EventAssignment}. 238 <p> 239 * @param version a long integer, the SBML Version to assign to this 240 * {@link EventAssignment}. 241 <p> 242 * <p> 243 * @throws SBMLConstructorException 244 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 245 * or if this object is incompatible with the given level and version. 246 <p> 247 * <p> 248 * @note Attempting to add an object to an {@link SBMLDocument} having a different 249 * combination of SBML Level, Version and XML namespaces than the object 250 * itself will result in an error at the time a caller attempts to make the 251 * addition. A parent object must have compatible Level, Version and XML 252 * namespaces. (Strictly speaking, a parent may also have more XML 253 * namespaces than a child, but the reverse is not permitted.) The 254 * restriction is necessary to ensure that an SBML model has a consistent 255 * overall structure. This requires callers to manage their objects 256 * carefully, but the benefit is increased flexibility in how models can be 257 * created by permitting callers to create objects bottom-up if desired. In 258 * situations where objects are not yet attached to parents (e.g., 259 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 260 * libSBML determine such things as whether it is valid to assign a 261 * particular value to an attribute. 262 */ public EventAssignment(long level, long version)263 EventAssignment(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 264 this(libsbmlJNI.new_EventAssignment__SWIG_0(level, version), true); 265 } 266 267 268 /** 269 * Creates a new {@link EventAssignment} using the given {@link SBMLNamespaces} object 270 * <code>sbmlns</code>. 271 <p> 272 * <p> 273 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 274 * information. It is used to communicate the SBML Level, Version, and (in 275 * Level 3) packages used in addition to SBML Level 3 Core. A 276 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 277 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 278 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 279 <p> 280 * @param sbmlns an {@link SBMLNamespaces} object. 281 <p> 282 * <p> 283 * @throws SBMLConstructorException 284 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible 285 * with this object. 286 <p> 287 * <p> 288 * @note Attempting to add an object to an {@link SBMLDocument} having a different 289 * combination of SBML Level, Version and XML namespaces than the object 290 * itself will result in an error at the time a caller attempts to make the 291 * addition. A parent object must have compatible Level, Version and XML 292 * namespaces. (Strictly speaking, a parent may also have more XML 293 * namespaces than a child, but the reverse is not permitted.) The 294 * restriction is necessary to ensure that an SBML model has a consistent 295 * overall structure. This requires callers to manage their objects 296 * carefully, but the benefit is increased flexibility in how models can be 297 * created by permitting callers to create objects bottom-up if desired. In 298 * situations where objects are not yet attached to parents (e.g., 299 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 300 * libSBML determine such things as whether it is valid to assign a 301 * particular value to an attribute. 302 */ public EventAssignment(SBMLNamespaces sbmlns)303 EventAssignment(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 304 this(libsbmlJNI.new_EventAssignment__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 305 } 306 307 308 /** 309 * Copy constructor; creates a copy of this {@link EventAssignment}. 310 <p> 311 * @param orig the object to copy. 312 */ public EventAssignment(EventAssignment orig)313 EventAssignment(EventAssignment orig) throws org.sbml.libsbml.SBMLConstructorException { 314 this(libsbmlJNI.new_EventAssignment__SWIG_2(EventAssignment.getCPtr(orig), orig), true); 315 } 316 317 318 /** 319 * Creates and returns a deep copy of this {@link EventAssignment} object. 320 <p> 321 * @return the (deep) copy of this {@link EventAssignment} object. 322 */ public cloneObject()323 EventAssignment cloneObject() { 324 long cPtr = libsbmlJNI.EventAssignment_cloneObject(swigCPtr, this); 325 return (cPtr == 0) ? null : new EventAssignment(cPtr, true); 326 } 327 328 329 /** 330 * Get the value of this {@link EventAssignment}'s 'variable' attribute. 331 <p> 332 * @return the identifier stored in the 'variable' attribute of this 333 * {@link EventAssignment}. 334 */ public getVariable()335 String getVariable() { 336 return libsbmlJNI.EventAssignment_getVariable(swigCPtr, this); 337 } 338 339 340 /** 341 * Get the mathematical expression in this {@link EventAssignment}'s 'math' 342 * subelement. 343 <p> 344 * @return the top {@link ASTNode} of an abstract syntax tree representing the 345 * mathematical formula in this {@link EventAssignment}, or <code>null</code> if the math is not set. 346 */ public getMath()347 ASTNode getMath() { 348 long cPtr = libsbmlJNI.EventAssignment_getMath(swigCPtr, this); 349 return (cPtr == 0) ? null : new ASTNode(cPtr, false); 350 } 351 352 353 /** 354 * Predicate for testing whether the attribute 'variable' of this 355 * {@link EventAssignment} is set. 356 <p> 357 * @return <code>true</code> if the 'variable' attribute of this {@link EventAssignment} 358 * is set, <code>false</code> otherwise. 359 */ public isSetVariable()360 boolean isSetVariable() { 361 return libsbmlJNI.EventAssignment_isSetVariable(swigCPtr, this); 362 } 363 364 365 /** 366 * Predicate for testing whether the 'math' subelement of this 367 * {@link EventAssignment} is set. 368 <p> 369 * @return <code>true</code> if this {@link EventAssignment} has a 'math' subelement, 370 * <code>false</code> otherwise. 371 */ public isSetMath()372 boolean isSetMath() { 373 return libsbmlJNI.EventAssignment_isSetMath(swigCPtr, this); 374 } 375 376 377 /** 378 * Sets the attribute 'variable' of this {@link EventAssignment} to a copy of 379 * the given identifier string. 380 <p> 381 * @param sid the identifier of an element defined in this model that 382 * can vary over time. 383 <p> 384 * <p> 385 * @return integer value indicating success/failure of the 386 * function. The possible values 387 * returned by this function are: 388 * <ul> 389 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 390 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 391 * </ul> 392 */ public setVariable(String sid)393 int setVariable(String sid) { 394 return libsbmlJNI.EventAssignment_setVariable(swigCPtr, this, sid); 395 } 396 397 398 /** 399 * Unsets the attribute 'variable' of this {@link EventAssignment}. 400 <p> 401 * <p> 402 * @return integer value indicating success/failure of the 403 * function. The possible values 404 * returned by this function are: 405 * <ul> 406 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 407 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 408 * </ul> 409 */ public unsetVariable()410 int unsetVariable() { 411 return libsbmlJNI.EventAssignment_unsetVariable(swigCPtr, this); 412 } 413 414 415 /** 416 * Sets the 'math' subelement of this {@link EventAssignment} to a copy of the 417 * given {@link ASTNode}. 418 <p> 419 * @param math an {@link ASTNode} that will be copied and stored as the 420 * mathematical formula for this {@link EventAssignment}. 421 <p> 422 * <p> 423 * @return integer value indicating success/failure of the 424 * function. The possible values 425 * returned by this function are: 426 * <ul> 427 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 428 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 429 * </ul> 430 */ public setMath(ASTNode math)431 int setMath(ASTNode math) { 432 return libsbmlJNI.EventAssignment_setMath(swigCPtr, this, ASTNode.getCPtr(math), math); 433 } 434 435 436 /** 437 * Calculates and returns a {@link UnitDefinition} that expresses the units of 438 * measurement assumed for the 'math' expression of this {@link EventAssignment}. 439 <p> 440 * <p> 441 * The units are calculated based on the mathematical expression in the 442 * {@link EventAssignment} and the model quantities referenced by 443 * <code><ci></code> elements used within that expression. The method 444 * getDerivedUnitDefinition() returns the calculated units, 445 * to the extent that libSBML can compute them. 446 <p> 447 * <p> 448 * @note The functionality that facilitates unit analysis depends on the 449 * model as a whole. Thus, in cases where the object has not been added to 450 * a model or the model itself is incomplete, unit analysis is not possible 451 * and this method will return <code>null.</code> 452 <p> 453 * <p> 454 * @warning Note that it is possible the 'math' expression in the 455 * {@link EventAssignment} contains literal numbers or parameters with undeclared 456 * units. In those cases, it is not possible to calculate the units of the 457 * overall expression without making assumptions. LibSBML does not make 458 * assumptions about the units, and 459 * getDerivedUnitDefinition() only returns the units as far 460 * as it is able to determine them. For example, in an expression <em>X + 461 * Y</em>, if <em>X</em> has unambiguously-defined units and <em>Y</em> does 462 * not, it will return the units of <em>X</em>. When using this method, 463 * <strong>it is critical that callers also invoke the method</strong> 464 * containsUndeclaredUnits() <strong>to determine whether 465 * this situation holds</strong>. Callers should take suitable action in 466 * those situations. 467 <p> 468 * @return a {@link UnitDefinition} that expresses the units of the math 469 * expression of this {@link EventAssignment}, or <code>null</code> if one cannot be constructed. 470 <p> 471 * @see #containsUndeclaredUnits() 472 */ public getDerivedUnitDefinition()473 UnitDefinition getDerivedUnitDefinition() { 474 long cPtr = libsbmlJNI.EventAssignment_getDerivedUnitDefinition__SWIG_0(swigCPtr, this); 475 return (cPtr == 0) ? null : new UnitDefinition(cPtr, false); 476 } 477 478 479 /** 480 * Predicate returning <code>true</code> if the math expression of this 481 * {@link EventAssignment} contains literal numbers or parameters with undeclared 482 * units. 483 <p> 484 * <p> 485 * The units are calculated based on the mathematical expression in the 486 * {@link EventAssignment} and the model quantities referenced by 487 * <code><ci></code> elements used within that expression. The method 488 * getDerivedUnitDefinition() returns the calculated units, 489 * to the extent that libSBML can compute them. 490 <p> 491 * If the expression contains literal numbers or parameters with undeclared 492 * units, libSBML may not be able to compute the full units of the 493 * expression and will only return what it can compute. Callers should 494 * always use containsUndeclaredUnits() when using 495 * getDerivedUnitDefinition() to decide whether the 496 * returned units may be incomplete. 497 <p> 498 * @return <code>true</code> if the math expression of this {@link EventAssignment} 499 * includes parameters/numbers 500 * with undeclared units, <code>false</code> otherwise. 501 <p> 502 * @note A return value of <code>true</code> indicates that the {@link UnitDefinition} 503 * returned by getDerivedUnitDefinition() may not 504 * accurately represent the units of the expression. 505 <p> 506 * @see #getDerivedUnitDefinition() 507 */ public containsUndeclaredUnits()508 boolean containsUndeclaredUnits() { 509 return libsbmlJNI.EventAssignment_containsUndeclaredUnits__SWIG_0(swigCPtr, this); 510 } 511 512 513 /** 514 * Returns the libSBML type code of this object instance. 515 <p> 516 * <p> 517 * LibSBML attaches an identifying code to every kind of SBML object. These 518 * are integer constants known as <em>SBML type codes</em>. The names of all 519 * the codes begin with the characters <code>SBML_</code>. 520 * In the Java language interface for libSBML, the 521 * type codes are defined as static integer constants in the interface class 522 * {@link libsbmlConstants}. Note that different Level 3 523 * package plug-ins may use overlapping type codes; to identify the package 524 * to which a given object belongs, call the 525 * <code>{@link SBase#getPackageName()} 526 * </code> 527 * method on the object. 528 <p> 529 * The exception to this is lists: all SBML-style list elements have the type 530 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF}, regardless of what package they 531 * are from. 532 <p> 533 * @return the SBML type code for this object: 534 * {@link libsbmlConstants#SBML_EVENT_ASSIGNMENT SBML_EVENT_ASSIGNMENT} (default). 535 <p> 536 * <p> 537 * @warning <span class='warning'>The specific integer values of the possible 538 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 539 * packages, To fully identify the correct code, <strong>it is necessary to 540 * invoke both getPackageName() and getTypeCode()</strong> (or 541 * {@link ListOf#getItemTypeCode()}).</span> 542 <p> 543 * @see #getElementName() 544 * @see #getPackageName() 545 */ public getTypeCode()546 int getTypeCode() { 547 return libsbmlJNI.EventAssignment_getTypeCode(swigCPtr, this); 548 } 549 550 551 /** 552 * Returns the XML element name of this object, which for 553 * {@link EventAssignment}, is always <code>'eventAssignment'.</code> 554 <p> 555 * @return the name of this element, i.e., <code>'eventAssignment'.</code> 556 */ public getElementName()557 String getElementName() { 558 return libsbmlJNI.EventAssignment_getElementName(swigCPtr, this); 559 } 560 561 562 /** 563 * Predicate returning <code>true</code> if all the required attributes for this 564 * {@link EventAssignment} object have been set. 565 <p> 566 * The required attributes for a {@link EventAssignment} object are: 567 * <ul> 568 * <li> 'variable' 569 * 570 * </ul> <p> 571 * @return <code>true</code> if the required attributes have been set, <code>false</code> 572 * otherwise. 573 */ public hasRequiredAttributes()574 boolean hasRequiredAttributes() { 575 return libsbmlJNI.EventAssignment_hasRequiredAttributes(swigCPtr, this); 576 } 577 578 579 /** 580 * Predicate returning <code>true</code> if all the required elements for this 581 * {@link EventAssignment} object have been set. 582 <p> 583 * @note The required elements for an {@link EventAssignment} object are: 584 * <ul> 585 * <li> 'math' in SBML Level 2 and Level 3 Version 1. 586 * (In SBML Level 3 Version 2+, it is no longer required.) 587 * 588 * </ul> <p> 589 * @return a boolean value indicating whether all the required 590 * elements for this object have been defined. 591 */ public hasRequiredElements()592 boolean hasRequiredElements() { 593 return libsbmlJNI.EventAssignment_hasRequiredElements(swigCPtr, this); 594 } 595 596 597 /** 598 * Returns the value of the 'variable' attribute of this {@link EventAssignment} (NOT the 'id'). 599 <p> 600 * @note Because of the inconsistent behavior of this function with 601 * respect to assignments and rules, it is now recommended to 602 * use the getIdAttribute() or getVariable() instead. 603 <p> 604 * The 'variable' attribute of an {@link EventAssignment} indicates the element which 605 * the results of the 'math' are to be applied upon {@link Event} execution. 606 <p> 607 * @return the variable of this {@link EventAssignment}. 608 <p> 609 * @see #getIdAttribute() 610 * @see #setIdAttribute(String sid) 611 * @see #isSetIdAttribute() 612 * @see #unsetIdAttribute() 613 * @see #getVariable() 614 */ public getId()615 String getId() { 616 return libsbmlJNI.EventAssignment_getId(swigCPtr, this); 617 } 618 619 620 /** 621 * <p> 622 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another 623 * value. 624 <p> 625 * <p> 626 * In SBML, object identifiers are of a data type called <code>SId</code>. 627 * In SBML Level 3, an explicit data type called <code>SIdRef</code> was 628 * introduced for attribute values that refer to <code>SId</code> values; in 629 * previous Levels of SBML, this data type did not exist and attributes were 630 * simply described to as 'referring to an identifier', but the effective 631 * data type was the same as <code>SIdRef</code> in Level 3. These and 632 * other methods of libSBML refer to the type <code>SIdRef</code> for all 633 * Levels of SBML, even if the corresponding SBML specification did not 634 * explicitly name the data type. 635 <p> 636 * This method works by looking at all attributes and (if appropriate) 637 * mathematical formulas in MathML content, comparing the referenced 638 * identifiers to the value of <code>oldid</code>. If any matches are found, the 639 * matching values are replaced with <code>newid</code>. The method does <em>not</em> 640 * descend into child elements. 641 <p> 642 * @param oldid the old identifier. 643 * @param newid the new identifier. 644 */ public renameSIdRefs(String oldid, String newid)645 void renameSIdRefs(String oldid, String newid) { 646 libsbmlJNI.EventAssignment_renameSIdRefs(swigCPtr, this, oldid, newid); 647 } 648 649 650 /** 651 * <p> 652 * Replaces all uses of a given <code>UnitSIdRef</code> type attribute value with 653 * another value. 654 <p> 655 * <p> 656 * In SBML, unit definitions have identifiers of type <code>UnitSId</code>. In 657 * SBML Level 3, an explicit data type called <code>UnitSIdRef</code> was 658 * introduced for attribute values that refer to <code>UnitSId</code> values; in 659 * previous Levels of SBML, this data type did not exist and attributes were 660 * simply described to as 'referring to a unit identifier', but the effective 661 * data type was the same as <code>UnitSIdRef</code> in Level 3. These and 662 * other methods of libSBML refer to the type <code>UnitSIdRef</code> for all 663 * Levels of SBML, even if the corresponding SBML specification did not 664 * explicitly name the data type. 665 <p> 666 * This method works by looking at all unit identifier attribute values 667 * (including, if appropriate, inside mathematical formulas), comparing the 668 * referenced unit identifiers to the value of <code>oldid</code>. If any matches 669 * are found, the matching values are replaced with <code>newid</code>. The method 670 * does <em>not</em> descend into child elements. 671 <p> 672 * @param oldid the old identifier. 673 * @param newid the new identifier. 674 */ public renameUnitSIdRefs(String oldid, String newid)675 void renameUnitSIdRefs(String oldid, String newid) { 676 libsbmlJNI.EventAssignment_renameUnitSIdRefs(swigCPtr, this, oldid, newid); 677 } 678 679 680 /** * @internal */ public replaceSIDWithFunction(String id, ASTNode function)681 void replaceSIDWithFunction(String id, ASTNode function) { 682 libsbmlJNI.EventAssignment_replaceSIDWithFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function); 683 } 684 685 686 /** * @internal */ public divideAssignmentsToSIdByFunction(String id, ASTNode function)687 void divideAssignmentsToSIdByFunction(String id, ASTNode function) { 688 libsbmlJNI.EventAssignment_divideAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function); 689 } 690 691 692 /** * @internal */ public multiplyAssignmentsToSIdByFunction(String id, ASTNode function)693 void multiplyAssignmentsToSIdByFunction(String id, ASTNode function) { 694 libsbmlJNI.EventAssignment_multiplyAssignmentsToSIdByFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function); 695 } 696 697 } 698