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 * A discontinuous SBML <em>event</em>. 13 <p> 14 * An SBML {@link Event} object defines when the event can occur, the variables 15 * that are affected by it, how the variables are affected, and the event's 16 * relationship to other events. The effect of the event can optionally be 17 * delayed after the occurrence of the condition which invokes it. 18 <p> 19 * The operation of {@link Event} is divided into two phases (even when the event 20 * is not delayed): one when the event is <em>triggered</em>, and the other when 21 * the event is <em>executed</em>. {@link Trigger} objects define the conditions for 22 * triggering an event, {@link Delay} objects define when the event is actually 23 * executed, {@link EventAssignment} objects define the effects of executing the 24 * event, and (in SBML Level 3) {@link Priority} objects influence the order 25 * of {@link EventAssignment} performance in cases of simultaneous events. Please 26 * consult the descriptions of {@link Trigger}, {@link Delay}, {@link EventAssignment} and {@link Priority} 27 * for more information. 28 <p> 29 * <h2>SBML Level/Version differences</h2> 30 <p> 31 * <h3>SBML Level 2</h3> 32 <p> 33 * In SBML Level 2 versions before Version 4, the semantics of 34 * {@link Event} time delays were defined such that the expressions in the event's 35 * assignments were always evaluated at the time the event was 36 * <em>triggered</em>. This definition made it difficult to define an event 37 * whose assignment formulas were meant to be evaluated at the time the 38 * event was <em>executed</em> (i.e., after the time period defined 39 * by the value of the {@link Delay} element, or after any other simultaneous 40 * event may have been <em>executed</em> and changed the model state). 41 * In SBML Level 2 Version 4 and in 42 * Level 3, the attribute 'useValuesFromTriggerTime' on {@link Event} was added 43 * to allow a model to indicate the time at which the event's assignments 44 * are to be calculated, whether at the moment the event is triggered (if 45 * the value of the attribute is <code>true</code>), or at the moment of execution 46 * (if 'useValuesFromTriggerTime'=<code>false</code>). If the event has a delay, 47 * the 'useValuesFromTriggerTime' is likely to make a significant difference 48 * in the values used in the assignment, but the possibility of simultaneous 49 * events mean that even zero-delay events can have different results 50 * depending on the value of this attribute. 51 <p> 52 * The definition of {@link Event} in SBML Level 2 Versions 1 and 2 includes 53 * an additional attribute called 'timeUnits', which allowed the time units 54 * of the {@link Delay} to be set explicitly. Later Versions of SBML Level 2 55 * as well as SBML Level 3 do not define this attribute. LibSBML 56 * supports this attribute for compatibility with previous versions of SBML 57 * Level 2; however, if a model in SBML Level 3 or Level 2 58 * Versions 3–4 format sets the attribute, the 59 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 60 * an error. 61 <p> 62 * The attribute 'useValuesFromTriggerTime' was introduced in SBML 63 * Level 2 Version 4. Models defined in prior Versions of SBML 64 * Level 2 cannot use this attribute, and 65 * {@link SBMLDocument#checkConsistency()} will report an error if they do. 66 <p> 67 * <h3>SBML Level 3</h3> 68 <p> 69 * SBML Level 3 introduces several changes to the structure and components 70 * of Events compared to SBML Level 2. These changes fall into two 71 * main categories: changes to what is optional or required, and additions 72 * of new attributes and elements. 73 * <ul> 74 * <li> The attribute 'useValuesFromTriggerTime' on {@link Event} is mandatory (it 75 * was optional in Level 2 and had a default value of <code>true</code>); 76 * <li> {@link Event}'s 'listOfEventAssignments' element (of class 77 * {@link ListOfEventAssignments}) is optional (it was mandatory in Level 2); 78 * <li> {@link Event}'s 'priority' element (of class {@link Priority}) is new in 79 * Level 3; and 80 * <li> The {@link Trigger} object gains new mandatory attributes (described as part 81 * of the definition of {@link Trigger}). 82 * <li> In SBML Level 3 Version 2, the {@link Trigger} object became 83 * optional. An {@link Event} with no {@link Trigger} will simply not fire. 84 * </ul> 85 <p> 86 * The changes to the attributes of {@link Event} are described below; the changes 87 * to {@link Trigger} and {@link Priority} are described in their respective sections. 88 <p> 89 * <h2>Semantics of events in SBML Level 3 Version 1</h2> 90 <p> 91 * The detailed semantics of events are described in the specification 92 * documents for each SBML Level/Version. Here we include the description 93 * from the SBML Level 1 Version 1. 94 * Any transition of a {@link Trigger} object's 'math' formula from the value 95 * <code>false</code> to <code>true</code> will cause the enclosing {@link Event} object to 96 * <em>trigger</em>. Such a transition is not possible at the very start 97 * of a simulation (i.e., at time <em>t = 0</em>) unless the {@link Trigger} 98 * object's 'initialValue' attribute has a value of <code>false</code>; this defines 99 * the value of the trigger formula to be <code>false</code> immediately prior to the 100 * start of simulation, thereby giving it the potential to change in value 101 * from <code>false</code> to <code>true</code> when the formula is evaluated at <em>t = 102 * 0</em>. If 'initialValue'=<code>true</code>, then the trigger expression cannot 103 * transition from <code>false</code> to <code>true</code> at <em>t = 0</em> but may do so at 104 * some time <em>t > 0</em>. 105 <p> 106 * Consider an {@link Event} object definition <EM>E</EM> with delay <em>d</em> in 107 * which the {@link Trigger} object's 'math' formula makes a transition in value 108 * from <code>false</code> to <code>true</code> at times <em>t<sub>1</sub></em> and 109 * <em>t<sub>2</sub></em>. The {@link EventAssignment} within the {@link Event} object 110 * will have effect at <em>t<sub>1</sub> + d</em> and 111 * <em>t<sub>2</sub> + d</em> irrespective of the relative times of 112 * <em>t<sub>1</sub></em> and <em>t<sub>2</sub></em>. For example, events 113 * can 'overlap' so that <em>t<sub>1</sub> < t<sub>2</sub> < 114 * t<sub>1</sub> + d</em> still causes an event assignments to occur at 115 * <em>t<sub>1</sub> + d</em> and <em>t<sub>2</sub> + d</em>. 116 <p> 117 * It is entirely possible for two events to be executed simultaneously, 118 * and it is possible for events to trigger other events (i.e., an event 119 * assignment can cause an event to trigger). This leads to several 120 * points: 121 * <ul> 122 <p> 123 * <li> A software package should retest all event triggers after executing 124 * an event assignment in order to account for the possibility that the 125 * assignment causes another event trigger to transition from <code>false</code> to 126 * <code>true.</code> This check should be made after each individual {@link Event} object's 127 * execution, even when several events are to be executed simultaneously. 128 <p> 129 * <li> Any {@link Event} object whose {@link Trigger} 'persistent' attribute has the value 130 * <code>false</code> must have its trigger expression reevaluated continuously 131 * between when the event is triggered and when it is executed. If 132 * its trigger expression ever evaluates to <code>false</code>, it must be removed 133 * from the queue of events pending execution and treated as any other 134 * event whose trigger expression evaluates to <code>false.</code> 135 <p> 136 * <li> Although the precise time at which events are executed is not 137 * resolved beyond the given execution point in simulated time, it is 138 * assumed that the order in which the events occur <em>is</em> resolved. 139 * This order can be significant in determining the overall outcome of a 140 * given simulation. When an event <EM>X</EM> <em>triggers</em> another 141 * event <EM>Y</EM> and event <EM>Y</EM> has zero delay, then event 142 * <EM>Y</EM> is added to the existing set of simultaneous events that are 143 * pending <em>execution</em>. Events <EM>X</EM> and <EM>Y</EM> form a 144 * cascade of events at the same point in simulation time. An event such 145 * as <EM>Y</EM> may have a special priority if it contains a {@link Priority} 146 * subobject. 147 <p> 148 * <li> All events in a model are open to being in a cascade. The position 149 * of an event in the event queue does not affect whether it can be in the 150 * cascade: event <EM>Y</EM> can be triggered whether it is before or after 151 * <EM>X</EM> in the queue of events pending execution. A cascade of 152 * events can be potentially infinite (never terminate); when this occurs a 153 * simulator should indicate this has occurred—it is incorrect for a 154 * simulator to break a cascade arbitrarily and continue the simulation 155 * without at least indicating that the infinite cascade occurred. 156 <p> 157 * <li> Simultaneous events having no defined priorities are executed in an 158 * undefined order. This does not mean that the behavior of the simulation 159 * is completely undefined; merely that the <em>order</em> of execution of 160 * these particular events is undefined. A given simulator may use any 161 * algorithm to choose an order as long as every event is executed exactly 162 * once. 163 <p> 164 * <li> Events with defined priorities are executed in the order implied by 165 * their {@link Priority} 'math' formula values, with events having higher 166 * priorities being executed ahead of events with lower priorities, and 167 * events with identical priorities being executed in a random order with 168 * respect to one another (as determined at run-time by some random 169 * algorithm equivalent to coin-flipping). Newly-triggered events that are 170 * to be executed immediately (i.e., if they define no delays) should be 171 * inserted into the queue of events pending execution according to their 172 * priorities: events with higher priority values value must be inserted 173 * ahead of events with lower priority values and after any pending events 174 * with even higher priorities, and inserted randomly among pending events 175 * with the same priority values. Events without {@link Priority} objects must be 176 * inserted into the queue in some fashion, but the algorithm used to place 177 * it in the queue is undefined. Similarly, there is no restriction on the 178 * order of a newly-inserted event with a defined {@link Priority} with respect to 179 * any other pending {@link Event} without a defined {@link Priority}. 180 <p> 181 * <li> A model variable that is the target of one or more event 182 * assignments can change more than once when simultaneous events are 183 * processed at some time point <em>t</em>. The model's behavior (output) 184 * for such a variable is the value of the variable at the end of 185 * processing all the simultaneous events at time <em>t</em>. 186 <p> 187 * </ul> 188 <p> 189 * <h2>Restrictions relaxed in SBML Level 3 Version 2</h2> 190 <p> 191 * In SBML Level 3 Version 2, several restrictions were lifted 192 * that have the potential to affect the semantics of an Event: 193 <p> 194 * <ul> 195 * <li> The {@link Trigger} subobject of an {@link Event} is optional. If missing, 196 * an {@link Event} is never <em>triggered</em>, unless an alternate triggering 197 * scheme is introduced by an SBML Level 3 package. 198 <p> 199 * <li> The 'math' subelements of an {@link Event} Trigger, {@link Delay}, {@link Priority}, 200 * and {@link EventAssignment} are all optional. If any of these elements lack 201 * a 'math' subelement, and that information is not supplied in an SBML 202 * Level 3 package, it is mathematically equivalent to the {@link Trigger}, 203 * {@link Delay}, {@link Priority}, or {@link EventAssignment} not being present at all. 204 <p> 205 * <li> The {@link ListOfEventAssignments} may be empty, which is mathematically 206 * equivalent to the {@link Event} not having a {@link ListOfEventAssignments} at all. 207 <p> 208 * <li> Any 'math' subelement may return a Boolean or a numeric value 209 * in any context. If a numeric value is used in a Boolean context, 210 * a '0' is interpreted as <code>false</code>, and all other values are 211 * interpreted as <code>true.</code> If a Boolean value is used in a numeric 212 * context, a <code>true</code> is interpreted as a 1, and a <code>false</code> is 213 * interpreted as a 0. This means (for example) that a {@link Trigger} value 214 * that changes from 0.0 to anything else is equivalent to changing 215 * from <code>false</code> to <code>true.</code> 216 * </ul> 217 <p> 218 * @see Trigger 219 * @see Priority 220 * @see Delay 221 * @see EventAssignment 222 */ 223 224 public class Event extends SBase { 225 private long swigCPtr; 226 Event(long cPtr, boolean cMemoryOwn)227 protected Event(long cPtr, boolean cMemoryOwn) 228 { 229 super(libsbmlJNI.Event_SWIGUpcast(cPtr), cMemoryOwn); 230 swigCPtr = cPtr; 231 } 232 getCPtr(Event obj)233 protected static long getCPtr(Event obj) 234 { 235 return (obj == null) ? 0 : obj.swigCPtr; 236 } 237 getCPtrAndDisown(Event obj)238 protected static long getCPtrAndDisown (Event obj) 239 { 240 long ptr = 0; 241 242 if (obj != null) 243 { 244 ptr = obj.swigCPtr; 245 obj.swigCMemOwn = false; 246 } 247 248 return ptr; 249 } 250 251 @SuppressWarnings("deprecation") finalize()252 protected void finalize() { 253 delete(); 254 } 255 delete()256 public synchronized void delete() { 257 if (swigCPtr != 0) { 258 if (swigCMemOwn) { 259 swigCMemOwn = false; 260 libsbmlJNI.delete_Event(swigCPtr); 261 } 262 swigCPtr = 0; 263 } 264 super.delete(); 265 } 266 267 268 /** 269 * Creates a new {@link Event} using the given SBML <code>level</code> and <code>version</code> 270 * values. 271 <p> 272 * @param level a long integer, the SBML Level to assign to this {@link Event}. 273 <p> 274 * @param version a long integer, the SBML Version to assign to this 275 * {@link Event}. 276 <p> 277 * <p> 278 * @throws SBMLConstructorException 279 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 280 * or if this object is incompatible with the given level and version. 281 <p> 282 * <p> 283 * @note Attempting to add an object to an {@link SBMLDocument} having a different 284 * combination of SBML Level, Version and XML namespaces than the object 285 * itself will result in an error at the time a caller attempts to make the 286 * addition. A parent object must have compatible Level, Version and XML 287 * namespaces. (Strictly speaking, a parent may also have more XML 288 * namespaces than a child, but the reverse is not permitted.) The 289 * restriction is necessary to ensure that an SBML model has a consistent 290 * overall structure. This requires callers to manage their objects 291 * carefully, but the benefit is increased flexibility in how models can be 292 * created by permitting callers to create objects bottom-up if desired. In 293 * situations where objects are not yet attached to parents (e.g., 294 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 295 * libSBML determine such things as whether it is valid to assign a 296 * particular value to an attribute. 297 */ public Event(long level, long version)298 Event(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 299 this(libsbmlJNI.new_Event__SWIG_0(level, version), true); 300 } 301 302 303 /** 304 * Creates a new {@link Event} using the given {@link SBMLNamespaces} object 305 * <code>sbmlns</code>. 306 <p> 307 * <p> 308 * The {@link SBMLNamespaces} object encapsulates SBML Level/Version/namespaces 309 * information. It is used to communicate the SBML Level, Version, and (in 310 * Level 3) packages used in addition to SBML Level 3 Core. A 311 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 312 * {@link SBMLNamespaces} object somewhere in a program once, then hand that object 313 * as needed to object constructors that accept {@link SBMLNamespaces} as arguments. 314 <p> 315 * @param sbmlns an {@link SBMLNamespaces} object. 316 <p> 317 * <p> 318 * @throws SBMLConstructorException 319 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible 320 * with this object. 321 <p> 322 * <p> 323 * @note Attempting to add an object to an {@link SBMLDocument} having a different 324 * combination of SBML Level, Version and XML namespaces than the object 325 * itself will result in an error at the time a caller attempts to make the 326 * addition. A parent object must have compatible Level, Version and XML 327 * namespaces. (Strictly speaking, a parent may also have more XML 328 * namespaces than a child, but the reverse is not permitted.) The 329 * restriction is necessary to ensure that an SBML model has a consistent 330 * overall structure. This requires callers to manage their objects 331 * carefully, but the benefit is increased flexibility in how models can be 332 * created by permitting callers to create objects bottom-up if desired. In 333 * situations where objects are not yet attached to parents (e.g., 334 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 335 * libSBML determine such things as whether it is valid to assign a 336 * particular value to an attribute. 337 */ public Event(SBMLNamespaces sbmlns)338 Event(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 339 this(libsbmlJNI.new_Event__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 340 } 341 342 343 /** 344 * Copy constructor; creates a copy of this {@link Event}. 345 <p> 346 * @param orig the object to copy. 347 */ public Event(Event orig)348 Event(Event orig) throws org.sbml.libsbml.SBMLConstructorException { 349 this(libsbmlJNI.new_Event__SWIG_2(Event.getCPtr(orig), orig), true); 350 } 351 352 353 /** 354 * Creates and returns a deep copy of this {@link Event} object. 355 <p> 356 * @return the (deep) copy of this {@link Event} object. 357 */ public cloneObject()358 Event cloneObject() { 359 long cPtr = libsbmlJNI.Event_cloneObject(swigCPtr, this); 360 return (cPtr == 0) ? null : new Event(cPtr, true); 361 } 362 363 364 /** 365 * Initializes the fields of this {@link Event} object to 'typical' default 366 * values. 367 <p> 368 * The SBML {@link Event} component has slightly different aspects and 369 * default attribute values in different SBML Levels and Versions. 370 * This method sets the values to certain common defaults, based 371 * mostly on what they are in SBML Level 2. Specifically: 372 <p> 373 * <ul> 374 * <li> Sets attribute 'useValuesFromTriggerTime' to <code>true</code> 375 * </ul> 376 */ public initDefaults()377 void initDefaults() { 378 libsbmlJNI.Event_initDefaults(swigCPtr, this); 379 } 380 381 382 /** 383 * Returns the first child element found that has the given <code>id</code> in the 384 * model-wide SId namespace, or <code>null</code> if no such object is found. 385 <p> 386 * @param id string representing the id of the object to find. 387 <p> 388 * @return pointer to the first element found with the given <code>id</code>. 389 */ public getElementBySId(String id)390 SBase getElementBySId(String id) { 391 return libsbml.DowncastSBase(libsbmlJNI.Event_getElementBySId(swigCPtr, this, id), false); 392 } 393 394 395 /** 396 * Returns the first child element it can find with the given <code>metaid</code>, or 397 * <code>null</code> if no such object is found. 398 <p> 399 * @param metaid string representing the metaid of the object to find. 400 <p> 401 * @return pointer to the first element found with the given <code>metaid</code>. 402 */ public getElementByMetaId(String metaid)403 SBase getElementByMetaId(String metaid) { 404 return libsbml.DowncastSBase(libsbmlJNI.Event_getElementByMetaId(swigCPtr, this, metaid), false); 405 } 406 407 408 /** 409 * Returns the value of the 'id' attribute of this {@link Event}. 410 <p> 411 * @note Because of the inconsistent behavior of this function with 412 * respect to assignments and rules, it is now recommended to 413 * use the getIdAttribute() function instead. 414 <p> 415 * <p> 416 * The identifier given by an object's 'id' attribute value 417 * is used to identify the object within the SBML model definition. 418 * Other objects can refer to the component using this identifier. The 419 * data type of 'id' is always <code>SId</code> or a type derived 420 * from that, such as <code>UnitSId</code>, depending on the object in 421 * question. All data types are defined as follows: 422 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 423 * letter .= 'a'..'z','A'..'Z' 424 * digit .= '0'..'9' 425 * idChar .= letter | digit | '_' 426 * SId .= ( letter | '_' ) idChar* 427 * </pre> 428 * The characters <code>(</code> and <code>)</code> are used for grouping, 429 * the character <code>*</code> 'zero or more times', and the character 430 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers 431 * is determined by an exact character sequence match; i.e., comparisons must 432 * be performed in a case-sensitive manner. This applies to all uses of 433 * <code>SId</code>, <code>SIdRef</code>, and derived types. 434 <p> 435 * Users need to be aware of some important API issues that are the result of 436 * the history of SBML and libSBML. Prior to SBML Level 3 437 * Version 2, SBML defined 'id' and 'name' attributes on only a subset 438 * of SBML objects. To simplify the work of programmers, libSBML's API 439 * provided get, set, check, and unset on the {@link SBase} object class itself 440 * instead of on individual subobject classes. This made the 441 * get/set/etc. methods uniformly available on all objects in the libSBML 442 * API. LibSBML simply returned empty strings or otherwise did not act when 443 * the methods were applied to SBML objects that were not defined by the SBML 444 * specification to have 'id' or 'name' attributes. Additional complications 445 * arose with the rule and assignment objects: {@link InitialAssignment}, 446 * {@link EventAssignment}, {@link AssignmentRule}, and {@link RateRule}. In early versions of SBML, 447 * the rule object hierarchy was different, and in addition, then as now, 448 * they possess different attributes: 'variable' (for the rules and event 449 * assignments), 'symbol' (for initial assignments), or neither (for 450 * algebraic rules). Prior to SBML Level 3 Version 2, getId() 451 * would always return an empty string, and isSetId() would always return 452 * <code>false</code> for objects of these classes. 453 <p> 454 * With the addition of 'id' and 'name' attributes on {@link SBase} in Level 3 455 * Version 2, it became necessary to introduce a new way to interact 456 * with the attributes more consistently in libSBML to avoid breaking 457 * backward compatibility in the behavior of the original 'id' methods. For 458 * this reason, libSBML provides four functions (getIdAttribute(), 459 * setIdAttribute(String), isSetIdAttribute(), and 460 * unsetIdAttribute()) that always act on the actual 'id' attribute inherited 461 * from {@link SBase}, regardless of the object's type. <strong>These new methods 462 * should be used instead of the older getId()/setId()/etc. methods</strong> 463 * unless the old behavior is somehow necessary. Regardless of the Level and 464 * Version of the SBML, these functions allow client applications to use more 465 * generalized code in some situations (for instance, when manipulating 466 * objects that are all known to have identifiers). If the object in 467 * question does not posess an 'id' attribute according to the SBML 468 * specification for the Level and Version in use, libSBML will not allow the 469 * identifier to be set, nor will it read or write 'id' attributes for those 470 * objects. 471 <p> 472 * @return the id of this {@link Event}. 473 <p> 474 * @see #getIdAttribute() 475 * @see #setIdAttribute(String sid) 476 * @see #isSetIdAttribute() 477 * @see #unsetIdAttribute() 478 */ public getId()479 String getId() { 480 return libsbmlJNI.Event_getId(swigCPtr, this); 481 } 482 483 484 /** 485 * Returns the value of the 'name' attribute of this {@link Event}. 486 <p> 487 * <p> 488 * <p> 489 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 490 * moved to {@link SBase} directly, instead of being defined individually for many 491 * (but not all) objects. LibSBML has for a long time provided functions 492 * defined on {@link SBase} itself to get, set, and unset those attributes, which 493 * would fail or otherwise return empty strings if executed on any object 494 * for which those attributes were not defined. Now that all {@link SBase} objects 495 * define those attributes, those functions now succeed for any object with 496 * the appropriate level and version. 497 <p> 498 * The 'name' attribute is 499 * optional and is not intended to be used for cross-referencing purposes 500 * within a model. Its purpose instead is to provide a human-readable 501 * label for the component. The data type of 'name' is the type 502 * <code>string</code> defined in XML Schema. SBML imposes no 503 * restrictions as to the content of 'name' attributes beyond those 504 * restrictions defined by the <code>string</code> type in XML Schema. 505 <p> 506 * The recommended practice for handling 'name' is as follows. If a 507 * software tool has the capability for displaying the content of 'name' 508 * attributes, it should display this content to the user as a 509 * component's label instead of the component's 'id'. If the user 510 * interface does not have this capability (e.g., because it cannot 511 * display or use special characters in symbol names), or if the 'name' 512 * attribute is missing on a given component, then the user interface 513 * should display the value of the 'id' attribute instead. (Script 514 * language interpreters are especially likely to display 'id' instead of 515 * 'name'.) 516 <p> 517 * As a consequence of the above, authors of systems that automatically 518 * generate the values of 'id' attributes should be aware some systems 519 * may display the 'id''s to the user. Authors therefore may wish to 520 * take some care to have their software create 'id' values that are: (a) 521 * reasonably easy for humans to type and read; and (b) likely to be 522 * meaningful, for example by making the 'id' attribute be an abbreviated 523 * form of the name attribute value. 524 <p> 525 * An additional point worth mentioning is although there are 526 * restrictions on the uniqueness of 'id' values, there are no 527 * restrictions on the uniqueness of 'name' values in a model. This 528 * allows software applications leeway in assigning component identifiers. 529 <p> 530 * Regardless of the level and version of the SBML, these functions allow 531 * client applications to use more generalized code in some situations 532 * (for instance, when manipulating objects that are all known to have 533 * names). If the object in question does not posess a 'name' attribute 534 * according to the SBML specification for the Level and Version in use, 535 * libSBML will not allow the name to be set, nor will it read or 536 * write 'name' attributes for those objects. 537 <p> 538 * @return the name of this SBML object, or the empty string if not set or unsettable. 539 <p> 540 * @see #getIdAttribute() 541 * @see #isSetName() 542 * @see #setName(String sid) 543 * @see #unsetName() 544 */ public getName()545 String getName() { 546 return libsbmlJNI.Event_getName(swigCPtr, this); 547 } 548 549 550 /** 551 * Get the event trigger portion of this {@link Event}. 552 <p> 553 * @return the {@link Trigger} object of this {@link Event}, or <code>null</code> if the trigger is not set. 554 */ public getTrigger()555 Trigger getTrigger() { 556 long cPtr = libsbmlJNI.Event_getTrigger__SWIG_0(swigCPtr, this); 557 return (cPtr == 0) ? null : new Trigger(cPtr, false); 558 } 559 560 561 /** 562 * Get the assignment delay portion of this {@link Event}, if there is one. 563 <p> 564 * @return the delay of this {@link Event} if one is defined, or <code>null</code> if none 565 * is defined. 566 */ public getDelay()567 Delay getDelay() { 568 long cPtr = libsbmlJNI.Event_getDelay__SWIG_0(swigCPtr, this); 569 return (cPtr == 0) ? null : new Delay(cPtr, false); 570 } 571 572 573 /** 574 * (SBML Level 3 only) Get the event priority portion of this 575 * {@link Event}. 576 <p> 577 * @return the {@link Priority} object of this {@link Event}, or <code>null</code> if the {@link Priority} 578 * has not been set. 579 <p> 580 * @note The element 'priority' is available in SBML Level 3, 581 * but is not present in lower Levels of SBML. 582 */ public getPriority()583 Priority getPriority() { 584 long cPtr = libsbmlJNI.Event_getPriority__SWIG_0(swigCPtr, this); 585 return (cPtr == 0) ? null : new Priority(cPtr, false); 586 } 587 588 589 /** 590 * Get the value of the 'timeUnits' attribute of this {@link Event}, if it has one. 591 <p> 592 * @return the value of the attribute 'timeUnits' as a string. 593 <p> 594 * <p> 595 * @warning <span class='warning'>Definitions of {@link Event} in SBML Level 2 596 * Versions 1 and 2 included the additional attribute called 597 * 'timeUnits', but it was removed in SBML Level 2 Version 3. 598 * LibSBML supports this attribute for compatibility with previous versions 599 * of SBML Level 2, but its use is discouraged since models in 600 * Level 2 Versions 3 and 4 cannot contain it. If a 601 * Version 3 or 4 model sets the attribute, the 602 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 603 * an error.</span> 604 */ public getTimeUnits()605 String getTimeUnits() { 606 return libsbmlJNI.Event_getTimeUnits(swigCPtr, this); 607 } 608 609 610 /** 611 * Get the value of the 'useValuesFromTriggerTime' attribute of this {@link Event}. 612 <p> 613 * <p> 614 * The optional {@link Delay} on {@link Event} and the fact that multiple events may be 615 * simultaneously executed means there are two times to consider when 616 * computing the results of an event: the time at which the event is 617 * <em>triggered</em>, and the time at which assignments are 618 * <em>executed</em>. It is also possible to distinguish between the 619 * time at which the {@link EventAssignment}'s expression is calculated, and the 620 * time at which the assignment is made: the expression could be 621 * evaluated at the same time the assignments are performed, i.e., when 622 * the event is <em>executed</em>, but it could also be defined to be 623 * evaluated at the time the event is <em>triggered</em>. 624 <p> 625 * In SBML Level 2 versions prior to Version 4, the semantics 626 * of {@link Event} time delays were defined such that the expressions in the 627 * event's assignments were always evaluated at the time the event was 628 * <em>triggered</em>. This definition made it difficult to define an 629 * event whose assignment formulas were meant to be evaluated at the time 630 * the event was <em>executed</em> (i.e., after the time period defined 631 * by the value of the {@link Delay} element, or after any other simultaneous 632 * event may have been <em>executed</em> and changed the model state). 633 * In SBML Level 2 634 * Version 4, the attribute 'useValuesFromTriggerTime' on {@link Event} 635 * allows a model to indicate the time at which the event's assignments 636 * are intended to be evaluated. In SBML Level 2, the attribute has 637 * a default value of <code>true</code>, which corresponds to the interpretation of 638 * event assignments prior to Version 4: the values of the 639 * assignment formulas are computed at the moment the event is triggered, 640 * not after the delay. If 'useValuesFromTriggerTime'=<code>false</code>, it means 641 * that the formulas in the event's assignments are to be computed after 642 * the delay, at the time the event is executed. In SBML Level 3, 643 * the attribute is mandatory, not optional, and all events must specify 644 * a value for it. 645 <p> 646 * @return the value of the attribute 'useValuesFromTriggerTime' as a boolean. 647 <p> 648 * <p> 649 * @warning <span class='warning'>The attribute 'useValuesFromTriggerTime' 650 * was introduced in SBML Level 2 Version 4. It is not valid in 651 * models defined using SBML Level 2 versions prior to Version 4. 652 * If a Level 2 Version 1–3 model sets the attribute, the 653 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 654 * an error.</span> 655 */ public getUseValuesFromTriggerTime()656 boolean getUseValuesFromTriggerTime() { 657 return libsbmlJNI.Event_getUseValuesFromTriggerTime(swigCPtr, this); 658 } 659 660 661 /** 662 * Predicate returning <code>true</code> if this 663 * {@link Event}'s 'id' attribute is set. 664 <p> 665 * <p> 666 * <p> 667 * The identifier given by an object's 'id' attribute value 668 * is used to identify the object within the SBML model definition. 669 * Other objects can refer to the component using this identifier. The 670 * data type of 'id' is always <code>SId</code> or a type derived 671 * from that, such as <code>UnitSId</code>, depending on the object in 672 * question. All data types are defined as follows: 673 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 674 * letter .= 'a'..'z','A'..'Z' 675 * digit .= '0'..'9' 676 * idChar .= letter | digit | '_' 677 * SId .= ( letter | '_' ) idChar* 678 * </pre> 679 * The characters <code>(</code> and <code>)</code> are used for grouping, 680 * the character <code>*</code> 'zero or more times', and the character 681 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers 682 * is determined by an exact character sequence match; i.e., comparisons must 683 * be performed in a case-sensitive manner. This applies to all uses of 684 * <code>SId</code>, <code>SIdRef</code>, and derived types. 685 <p> 686 * Users need to be aware of some important API issues that are the result of 687 * the history of SBML and libSBML. Prior to SBML Level 3 688 * Version 2, SBML defined 'id' and 'name' attributes on only a subset 689 * of SBML objects. To simplify the work of programmers, libSBML's API 690 * provided get, set, check, and unset on the {@link SBase} object class itself 691 * instead of on individual subobject classes. This made the 692 * get/set/etc. methods uniformly available on all objects in the libSBML 693 * API. LibSBML simply returned empty strings or otherwise did not act when 694 * the methods were applied to SBML objects that were not defined by the SBML 695 * specification to have 'id' or 'name' attributes. Additional complications 696 * arose with the rule and assignment objects: {@link InitialAssignment}, 697 * {@link EventAssignment}, {@link AssignmentRule}, and {@link RateRule}. In early versions of SBML, 698 * the rule object hierarchy was different, and in addition, then as now, 699 * they possess different attributes: 'variable' (for the rules and event 700 * assignments), 'symbol' (for initial assignments), or neither (for 701 * algebraic rules). Prior to SBML Level 3 Version 2, getId() 702 * would always return an empty string, and isSetId() would always return 703 * <code>false</code> for objects of these classes. 704 <p> 705 * With the addition of 'id' and 'name' attributes on {@link SBase} in Level 3 706 * Version 2, it became necessary to introduce a new way to interact 707 * with the attributes more consistently in libSBML to avoid breaking 708 * backward compatibility in the behavior of the original 'id' methods. For 709 * this reason, libSBML provides four functions (getIdAttribute(), 710 * setIdAttribute(String), isSetIdAttribute(), and 711 * unsetIdAttribute()) that always act on the actual 'id' attribute inherited 712 * from {@link SBase}, regardless of the object's type. <strong>These new methods 713 * should be used instead of the older getId()/setId()/etc. methods</strong> 714 * unless the old behavior is somehow necessary. Regardless of the Level and 715 * Version of the SBML, these functions allow client applications to use more 716 * generalized code in some situations (for instance, when manipulating 717 * objects that are all known to have identifiers). If the object in 718 * question does not posess an 'id' attribute according to the SBML 719 * specification for the Level and Version in use, libSBML will not allow the 720 * identifier to be set, nor will it read or write 'id' attributes for those 721 * objects. 722 <p> 723 * @return <code>true</code> if the 'id' attribute of this SBML object is 724 * set, <code>false</code> otherwise. 725 <p> 726 * @note Because of the inconsistent behavior of this function with 727 * respect to assignments and rules, it is recommended that callers 728 * use isSetIdAttribute() instead. 729 <p> 730 * @see #getIdAttribute() 731 * @see #setIdAttribute(String sid) 732 * @see #unsetIdAttribute() 733 * @see #isSetIdAttribute() 734 */ public isSetId()735 boolean isSetId() { 736 return libsbmlJNI.Event_isSetId(swigCPtr, this); 737 } 738 739 740 /** 741 * Predicate returning <code>true</code> if this 742 * {@link Event}'s 'name' attribute is set. 743 <p> 744 * <p> 745 * <p> 746 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 747 * moved to {@link SBase} directly, instead of being defined individually for many 748 * (but not all) objects. LibSBML has for a long time provided functions 749 * defined on {@link SBase} itself to get, set, and unset those attributes, which 750 * would fail or otherwise return empty strings if executed on any object 751 * for which those attributes were not defined. Now that all {@link SBase} objects 752 * define those attributes, those functions now succeed for any object with 753 * the appropriate level and version. 754 <p> 755 * The 'name' attribute is 756 * optional and is not intended to be used for cross-referencing purposes 757 * within a model. Its purpose instead is to provide a human-readable 758 * label for the component. The data type of 'name' is the type 759 * <code>string</code> defined in XML Schema. SBML imposes no 760 * restrictions as to the content of 'name' attributes beyond those 761 * restrictions defined by the <code>string</code> type in XML Schema. 762 <p> 763 * The recommended practice for handling 'name' is as follows. If a 764 * software tool has the capability for displaying the content of 'name' 765 * attributes, it should display this content to the user as a 766 * component's label instead of the component's 'id'. If the user 767 * interface does not have this capability (e.g., because it cannot 768 * display or use special characters in symbol names), or if the 'name' 769 * attribute is missing on a given component, then the user interface 770 * should display the value of the 'id' attribute instead. (Script 771 * language interpreters are especially likely to display 'id' instead of 772 * 'name'.) 773 <p> 774 * As a consequence of the above, authors of systems that automatically 775 * generate the values of 'id' attributes should be aware some systems 776 * may display the 'id''s to the user. Authors therefore may wish to 777 * take some care to have their software create 'id' values that are: (a) 778 * reasonably easy for humans to type and read; and (b) likely to be 779 * meaningful, for example by making the 'id' attribute be an abbreviated 780 * form of the name attribute value. 781 <p> 782 * An additional point worth mentioning is although there are 783 * restrictions on the uniqueness of 'id' values, there are no 784 * restrictions on the uniqueness of 'name' values in a model. This 785 * allows software applications leeway in assigning component identifiers. 786 <p> 787 * Regardless of the level and version of the SBML, these functions allow 788 * client applications to use more generalized code in some situations 789 * (for instance, when manipulating objects that are all known to have 790 * names). If the object in question does not posess a 'name' attribute 791 * according to the SBML specification for the Level and Version in use, 792 * libSBML will not allow the name to be set, nor will it read or 793 * write 'name' attributes for those objects. 794 <p> 795 * @return <code>true</code> if the 'name' attribute of this SBML object is 796 * set, <code>false</code> otherwise. 797 <p> 798 * @see #getName() 799 * @see #setName(String sid) 800 * @see #unsetName() 801 */ public isSetName()802 boolean isSetName() { 803 return libsbmlJNI.Event_isSetName(swigCPtr, this); 804 } 805 806 807 /** 808 * Predicate for testing whether the trigger for this {@link Event} is set. 809 <p> 810 * @return <code>true</code> if the trigger of this {@link Event} is set, <code>false</code> 811 * otherwise. 812 */ public isSetTrigger()813 boolean isSetTrigger() { 814 return libsbmlJNI.Event_isSetTrigger(swigCPtr, this); 815 } 816 817 818 /** 819 * Predicate for testing whether the delay for this {@link Event} is set. 820 <p> 821 * @return <code>true</code> if the delay of this {@link Event} is set, <code>false</code> 822 * otherwise. 823 */ public isSetDelay()824 boolean isSetDelay() { 825 return libsbmlJNI.Event_isSetDelay(swigCPtr, this); 826 } 827 828 829 /** 830 * (SBML Level 3 only) Predicate for testing whether the priority 831 * for this {@link Event} is set. 832 <p> 833 * @return <code>true</code> if the priority of this {@link Event} is set, <code>false</code> 834 * otherwise. 835 <p> 836 * @note The element 'priority' is available in SBML Level 3, 837 * but is not present in lower Levels of SBML. 838 */ public isSetPriority()839 boolean isSetPriority() { 840 return libsbmlJNI.Event_isSetPriority(swigCPtr, this); 841 } 842 843 844 /** 845 * Predicate for testing whether the 'timeUnits' attribute of this {@link Event} 846 * is set. 847 <p> 848 * @return <code>true</code> if the 'timeUnits' attribute of this {@link Event} is 849 * set, <code>false</code> otherwise. 850 <p> 851 * <p> 852 * @warning <span class='warning'>Definitions of {@link Event} in SBML Level 2 853 * Versions 1 and 2 included the additional attribute called 854 * 'timeUnits', but it was removed in SBML Level 2 Version 3. 855 * LibSBML supports this attribute for compatibility with previous versions 856 * of SBML Level 2, but its use is discouraged since models in 857 * Level 2 Versions 3 and 4 cannot contain it. If a 858 * Version 3 or 4 model sets the attribute, the 859 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 860 * an error.</span> 861 */ public isSetTimeUnits()862 boolean isSetTimeUnits() { 863 return libsbmlJNI.Event_isSetTimeUnits(swigCPtr, this); 864 } 865 866 867 /** 868 * Predicate for testing whether the 'useValuesFromTriggerTime' attribute of this {@link Event} 869 * is set. 870 <p> 871 * @return <code>true</code> if the 'useValuesFromTriggerTime' attribute of this {@link Event} is 872 * set, <code>false</code> otherwise. 873 <p> 874 * @note In SBML Level 2, this attribute is optional and has a default value of 875 * <code>true</code>, whereas in Level 3, this optional is mandatory and 876 * has no default value. 877 */ public isSetUseValuesFromTriggerTime()878 boolean isSetUseValuesFromTriggerTime() { 879 return libsbmlJNI.Event_isSetUseValuesFromTriggerTime(swigCPtr, this); 880 } 881 882 883 /** 884 * Sets the value of the 'id' attribute of this {@link Event}. 885 <p> 886 * <p> 887 * The string <code>sid</code> is copied. 888 <p> 889 * <p> 890 * The identifier given by an object's 'id' attribute value 891 * is used to identify the object within the SBML model definition. 892 * Other objects can refer to the component using this identifier. The 893 * data type of 'id' is always <code>SId</code> or a type derived 894 * from that, such as <code>UnitSId</code>, depending on the object in 895 * question. All data types are defined as follows: 896 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 897 * letter .= 'a'..'z','A'..'Z' 898 * digit .= '0'..'9' 899 * idChar .= letter | digit | '_' 900 * SId .= ( letter | '_' ) idChar* 901 * </pre> 902 * The characters <code>(</code> and <code>)</code> are used for grouping, 903 * the character <code>*</code> 'zero or more times', and the character 904 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers 905 * is determined by an exact character sequence match; i.e., comparisons must 906 * be performed in a case-sensitive manner. This applies to all uses of 907 * <code>SId</code>, <code>SIdRef</code>, and derived types. 908 <p> 909 * Users need to be aware of some important API issues that are the result of 910 * the history of SBML and libSBML. Prior to SBML Level 3 911 * Version 2, SBML defined 'id' and 'name' attributes on only a subset 912 * of SBML objects. To simplify the work of programmers, libSBML's API 913 * provided get, set, check, and unset on the {@link SBase} object class itself 914 * instead of on individual subobject classes. This made the 915 * get/set/etc. methods uniformly available on all objects in the libSBML 916 * API. LibSBML simply returned empty strings or otherwise did not act when 917 * the methods were applied to SBML objects that were not defined by the SBML 918 * specification to have 'id' or 'name' attributes. Additional complications 919 * arose with the rule and assignment objects: {@link InitialAssignment}, 920 * {@link EventAssignment}, {@link AssignmentRule}, and {@link RateRule}. In early versions of SBML, 921 * the rule object hierarchy was different, and in addition, then as now, 922 * they possess different attributes: 'variable' (for the rules and event 923 * assignments), 'symbol' (for initial assignments), or neither (for 924 * algebraic rules). Prior to SBML Level 3 Version 2, getId() 925 * would always return an empty string, and isSetId() would always return 926 * <code>false</code> for objects of these classes. 927 <p> 928 * With the addition of 'id' and 'name' attributes on {@link SBase} in Level 3 929 * Version 2, it became necessary to introduce a new way to interact 930 * with the attributes more consistently in libSBML to avoid breaking 931 * backward compatibility in the behavior of the original 'id' methods. For 932 * this reason, libSBML provides four functions (getIdAttribute(), 933 * setIdAttribute(String), isSetIdAttribute(), and 934 * unsetIdAttribute()) that always act on the actual 'id' attribute inherited 935 * from {@link SBase}, regardless of the object's type. <strong>These new methods 936 * should be used instead of the older getId()/setId()/etc. methods</strong> 937 * unless the old behavior is somehow necessary. Regardless of the Level and 938 * Version of the SBML, these functions allow client applications to use more 939 * generalized code in some situations (for instance, when manipulating 940 * objects that are all known to have identifiers). If the object in 941 * question does not posess an 'id' attribute according to the SBML 942 * specification for the Level and Version in use, libSBML will not allow the 943 * identifier to be set, nor will it read or write 'id' attributes for those 944 * objects. 945 <p> 946 * @param sid the string to use as the identifier of this object. 947 <p> 948 * <p> 949 * @return integer value indicating success/failure of the 950 * function. The possible values 951 * returned by this function are: 952 * <ul> 953 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 954 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 955 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 956 * 957 * </ul> <p> 958 * @see #getIdAttribute() 959 * @see #setIdAttribute(String sid) 960 * @see #isSetIdAttribute() 961 * @see #unsetIdAttribute() 962 */ public setId(String sid)963 int setId(String sid) { 964 return libsbmlJNI.Event_setId(swigCPtr, this, sid); 965 } 966 967 968 /** 969 * Sets the value of the 'name' attribute of this {@link Event}. 970 <p> 971 * <p> 972 * The string in <code>name</code> is copied. 973 <p> 974 * @param name the new name for the SBML object. 975 <p> 976 * <p> 977 * @return integer value indicating success/failure of the 978 * function. The possible values 979 * returned by this function are: 980 * <ul> 981 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 982 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 983 * 984 * </ul> 985 */ public setName(String name)986 int setName(String name) { 987 return libsbmlJNI.Event_setName(swigCPtr, this, name); 988 } 989 990 991 /** 992 * Sets the trigger definition of this {@link Event} to a copy of the given 993 * {@link Trigger} object instance. 994 <p> 995 * @param trigger the {@link Trigger} object instance to use. 996 <p> 997 * <p> 998 * @return integer value indicating success/failure of the 999 * function. The possible values 1000 * returned by this function are: 1001 * <ul> 1002 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1003 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 1004 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 1005 * </ul> 1006 */ public setTrigger(Trigger trigger)1007 int setTrigger(Trigger trigger) { 1008 return libsbmlJNI.Event_setTrigger(swigCPtr, this, Trigger.getCPtr(trigger), trigger); 1009 } 1010 1011 1012 /** 1013 * Sets the delay definition of this {@link Event} to a copy of the given {@link Delay} 1014 * object instance. 1015 <p> 1016 * @param delay the {@link Delay} object instance to use. 1017 <p> 1018 * <p> 1019 * @return integer value indicating success/failure of the 1020 * function. The possible values 1021 * returned by this function are: 1022 * <ul> 1023 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1024 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 1025 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 1026 * </ul> 1027 */ public setDelay(Delay delay)1028 int setDelay(Delay delay) { 1029 return libsbmlJNI.Event_setDelay(swigCPtr, this, Delay.getCPtr(delay), delay); 1030 } 1031 1032 1033 /** 1034 * (SBML Level 3 only) Sets the priority definition of this {@link Event} 1035 * to a copy of the given {@link Priority} object instance. 1036 <p> 1037 * @param priority the {@link Priority} object instance to use. 1038 <p> 1039 * <p> 1040 * @return integer value indicating success/failure of the 1041 * function. The possible values 1042 * returned by this function are: 1043 * <ul> 1044 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1045 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 1046 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 1047 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 1048 * 1049 * </ul> <p> 1050 * @note The element 'priority' is available in SBML Level 3, 1051 * but is not present in lower Levels of SBML. 1052 */ public setPriority(Priority priority)1053 int setPriority(Priority priority) { 1054 return libsbmlJNI.Event_setPriority(swigCPtr, this, Priority.getCPtr(priority), priority); 1055 } 1056 1057 1058 /** 1059 * Sets the 'timeUnits' attribute of this {@link Event} to a copy of <code>sid</code>. 1060 <p> 1061 * @param sid the identifier of the time units to use. 1062 <p> 1063 * <p> 1064 * @return integer value indicating success/failure of the 1065 * function. The possible values 1066 * returned by this function are: 1067 * <ul> 1068 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1069 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 1070 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 1071 * 1072 * </ul> <p> 1073 * <p> 1074 * @warning <span class='warning'>Definitions of {@link Event} in SBML Level 2 1075 * Versions 1 and 2 included the additional attribute called 1076 * 'timeUnits', but it was removed in SBML Level 2 Version 3. 1077 * LibSBML supports this attribute for compatibility with previous versions 1078 * of SBML Level 2, but its use is discouraged since models in 1079 * Level 2 Versions 3 and 4 cannot contain it. If a 1080 * Version 3 or 4 model sets the attribute, the 1081 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 1082 * an error.</span> 1083 */ public setTimeUnits(String sid)1084 int setTimeUnits(String sid) { 1085 return libsbmlJNI.Event_setTimeUnits(swigCPtr, this, sid); 1086 } 1087 1088 1089 /** 1090 * Sets the 'useValuesFromTriggerTime' attribute of this {@link Event} to a <code>value</code>. 1091 <p> 1092 * <p> 1093 * The optional {@link Delay} on {@link Event} and the fact that multiple events may be 1094 * simultaneously executed means there are two times to consider when 1095 * computing the results of an event: the time at which the event is 1096 * <em>triggered</em>, and the time at which assignments are 1097 * <em>executed</em>. It is also possible to distinguish between the 1098 * time at which the {@link EventAssignment}'s expression is calculated, and the 1099 * time at which the assignment is made: the expression could be 1100 * evaluated at the same time the assignments are performed, i.e., when 1101 * the event is <em>executed</em>, but it could also be defined to be 1102 * evaluated at the time the event is <em>triggered</em>. 1103 <p> 1104 * In SBML Level 2 versions prior to Version 4, the semantics 1105 * of {@link Event} time delays were defined such that the expressions in the 1106 * event's assignments were always evaluated at the time the event was 1107 * <em>triggered</em>. This definition made it difficult to define an 1108 * event whose assignment formulas were meant to be evaluated at the time 1109 * the event was <em>executed</em> (i.e., after the time period defined 1110 * by the value of the {@link Delay} element, or after any other simultaneous 1111 * event may have been <em>executed</em> and changed the model state). 1112 * In SBML Level 2 1113 * Version 4, the attribute 'useValuesFromTriggerTime' on {@link Event} 1114 * allows a model to indicate the time at which the event's assignments 1115 * are intended to be evaluated. In SBML Level 2, the attribute has 1116 * a default value of <code>true</code>, which corresponds to the interpretation of 1117 * event assignments prior to Version 4: the values of the 1118 * assignment formulas are computed at the moment the event is triggered, 1119 * not after the delay. If 'useValuesFromTriggerTime'=<code>false</code>, it means 1120 * that the formulas in the event's assignments are to be computed after 1121 * the delay, at the time the event is executed. In SBML Level 3, 1122 * the attribute is mandatory, not optional, and all events must specify 1123 * a value for it. 1124 <p> 1125 * @param value the value of useValuesFromTriggerTime to use. 1126 <p> 1127 * <p> 1128 * @return integer value indicating success/failure of the 1129 * function. The possible values 1130 * returned by this function are: 1131 * <ul> 1132 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1133 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 1134 * 1135 * </ul> <p> 1136 * <p> 1137 * @warning <span class='warning'>The attribute 'useValuesFromTriggerTime' 1138 * was introduced in SBML Level 2 Version 4. It is not valid in 1139 * models defined using SBML Level 2 versions prior to Version 4. 1140 * If a Level 2 Version 1–3 model sets the attribute, the 1141 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 1142 * an error.</span> 1143 */ public setUseValuesFromTriggerTime(boolean value)1144 int setUseValuesFromTriggerTime(boolean value) { 1145 return libsbmlJNI.Event_setUseValuesFromTriggerTime(swigCPtr, this, value); 1146 } 1147 1148 1149 /** 1150 * Unsets the value of the 'id' attribute of this {@link Event}. 1151 <p> 1152 * <p> 1153 * <p> 1154 * The identifier given by an object's 'id' attribute value 1155 * is used to identify the object within the SBML model definition. 1156 * Other objects can refer to the component using this identifier. The 1157 * data type of 'id' is always <code>SId</code> or a type derived 1158 * from that, such as <code>UnitSId</code>, depending on the object in 1159 * question. All data types are defined as follows: 1160 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 1161 * letter .= 'a'..'z','A'..'Z' 1162 * digit .= '0'..'9' 1163 * idChar .= letter | digit | '_' 1164 * SId .= ( letter | '_' ) idChar* 1165 * </pre> 1166 * The characters <code>(</code> and <code>)</code> are used for grouping, 1167 * the character <code>*</code> 'zero or more times', and the character 1168 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers 1169 * is determined by an exact character sequence match; i.e., comparisons must 1170 * be performed in a case-sensitive manner. This applies to all uses of 1171 * <code>SId</code>, <code>SIdRef</code>, and derived types. 1172 <p> 1173 * Users need to be aware of some important API issues that are the result of 1174 * the history of SBML and libSBML. Prior to SBML Level 3 1175 * Version 2, SBML defined 'id' and 'name' attributes on only a subset 1176 * of SBML objects. To simplify the work of programmers, libSBML's API 1177 * provided get, set, check, and unset on the {@link SBase} object class itself 1178 * instead of on individual subobject classes. This made the 1179 * get/set/etc. methods uniformly available on all objects in the libSBML 1180 * API. LibSBML simply returned empty strings or otherwise did not act when 1181 * the methods were applied to SBML objects that were not defined by the SBML 1182 * specification to have 'id' or 'name' attributes. Additional complications 1183 * arose with the rule and assignment objects: {@link InitialAssignment}, 1184 * {@link EventAssignment}, {@link AssignmentRule}, and {@link RateRule}. In early versions of SBML, 1185 * the rule object hierarchy was different, and in addition, then as now, 1186 * they possess different attributes: 'variable' (for the rules and event 1187 * assignments), 'symbol' (for initial assignments), or neither (for 1188 * algebraic rules). Prior to SBML Level 3 Version 2, getId() 1189 * would always return an empty string, and isSetId() would always return 1190 * <code>false</code> for objects of these classes. 1191 <p> 1192 * With the addition of 'id' and 'name' attributes on {@link SBase} in Level 3 1193 * Version 2, it became necessary to introduce a new way to interact 1194 * with the attributes more consistently in libSBML to avoid breaking 1195 * backward compatibility in the behavior of the original 'id' methods. For 1196 * this reason, libSBML provides four functions (getIdAttribute(), 1197 * setIdAttribute(String), isSetIdAttribute(), and 1198 * unsetIdAttribute()) that always act on the actual 'id' attribute inherited 1199 * from {@link SBase}, regardless of the object's type. <strong>These new methods 1200 * should be used instead of the older getId()/setId()/etc. methods</strong> 1201 * unless the old behavior is somehow necessary. Regardless of the Level and 1202 * Version of the SBML, these functions allow client applications to use more 1203 * generalized code in some situations (for instance, when manipulating 1204 * objects that are all known to have identifiers). If the object in 1205 * question does not posess an 'id' attribute according to the SBML 1206 * specification for the Level and Version in use, libSBML will not allow the 1207 * identifier to be set, nor will it read or write 'id' attributes for those 1208 * objects. 1209 <p> 1210 * <p> 1211 * @return integer value indicating success/failure of the 1212 * function. The possible values 1213 * returned by this function are: 1214 * <ul> 1215 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1216 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1217 * 1218 * </ul> <p> 1219 * @see #getIdAttribute() 1220 * @see #setIdAttribute(String sid) 1221 * @see #isSetIdAttribute() 1222 * @see #unsetIdAttribute() 1223 */ public unsetId()1224 int unsetId() { 1225 return libsbmlJNI.Event_unsetId(swigCPtr, this); 1226 } 1227 1228 1229 /** 1230 * Unsets the value of the 'name' attribute of this {@link Event}. 1231 <p> 1232 * <p> 1233 * <p> 1234 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 1235 * moved to {@link SBase} directly, instead of being defined individually for many 1236 * (but not all) objects. LibSBML has for a long time provided functions 1237 * defined on {@link SBase} itself to get, set, and unset those attributes, which 1238 * would fail or otherwise return empty strings if executed on any object 1239 * for which those attributes were not defined. Now that all {@link SBase} objects 1240 * define those attributes, those functions now succeed for any object with 1241 * the appropriate level and version. 1242 <p> 1243 * The 'name' attribute is 1244 * optional and is not intended to be used for cross-referencing purposes 1245 * within a model. Its purpose instead is to provide a human-readable 1246 * label for the component. The data type of 'name' is the type 1247 * <code>string</code> defined in XML Schema. SBML imposes no 1248 * restrictions as to the content of 'name' attributes beyond those 1249 * restrictions defined by the <code>string</code> type in XML Schema. 1250 <p> 1251 * The recommended practice for handling 'name' is as follows. If a 1252 * software tool has the capability for displaying the content of 'name' 1253 * attributes, it should display this content to the user as a 1254 * component's label instead of the component's 'id'. If the user 1255 * interface does not have this capability (e.g., because it cannot 1256 * display or use special characters in symbol names), or if the 'name' 1257 * attribute is missing on a given component, then the user interface 1258 * should display the value of the 'id' attribute instead. (Script 1259 * language interpreters are especially likely to display 'id' instead of 1260 * 'name'.) 1261 <p> 1262 * As a consequence of the above, authors of systems that automatically 1263 * generate the values of 'id' attributes should be aware some systems 1264 * may display the 'id''s to the user. Authors therefore may wish to 1265 * take some care to have their software create 'id' values that are: (a) 1266 * reasonably easy for humans to type and read; and (b) likely to be 1267 * meaningful, for example by making the 'id' attribute be an abbreviated 1268 * form of the name attribute value. 1269 <p> 1270 * An additional point worth mentioning is although there are 1271 * restrictions on the uniqueness of 'id' values, there are no 1272 * restrictions on the uniqueness of 'name' values in a model. This 1273 * allows software applications leeway in assigning component identifiers. 1274 <p> 1275 * Regardless of the level and version of the SBML, these functions allow 1276 * client applications to use more generalized code in some situations 1277 * (for instance, when manipulating objects that are all known to have 1278 * names). If the object in question does not posess a 'name' attribute 1279 * according to the SBML specification for the Level and Version in use, 1280 * libSBML will not allow the name to be set, nor will it read or 1281 * write 'name' attributes for those objects. 1282 <p> 1283 * <p> 1284 * @return integer value indicating success/failure of the 1285 * function. The possible values 1286 * returned by this function are: 1287 * <ul> 1288 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1289 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1290 * 1291 * </ul> <p> 1292 * @see #getName() 1293 * @see #setName(String sid) 1294 * @see #isSetName() 1295 */ public unsetName()1296 int unsetName() { 1297 return libsbmlJNI.Event_unsetName(swigCPtr, this); 1298 } 1299 1300 1301 /** 1302 * Unsets the value of the 'useValuesFromTriggerTime' attribute of this {@link Event}. 1303 <p> 1304 * <p> 1305 * The optional {@link Delay} on {@link Event} and the fact that multiple events may be 1306 * simultaneously executed means there are two times to consider when 1307 * computing the results of an event: the time at which the event is 1308 * <em>triggered</em>, and the time at which assignments are 1309 * <em>executed</em>. It is also possible to distinguish between the 1310 * time at which the {@link EventAssignment}'s expression is calculated, and the 1311 * time at which the assignment is made: the expression could be 1312 * evaluated at the same time the assignments are performed, i.e., when 1313 * the event is <em>executed</em>, but it could also be defined to be 1314 * evaluated at the time the event is <em>triggered</em>. 1315 <p> 1316 * In SBML Level 2 versions prior to Version 4, the semantics 1317 * of {@link Event} time delays were defined such that the expressions in the 1318 * event's assignments were always evaluated at the time the event was 1319 * <em>triggered</em>. This definition made it difficult to define an 1320 * event whose assignment formulas were meant to be evaluated at the time 1321 * the event was <em>executed</em> (i.e., after the time period defined 1322 * by the value of the {@link Delay} element, or after any other simultaneous 1323 * event may have been <em>executed</em> and changed the model state). 1324 * In SBML Level 2 1325 * Version 4, the attribute 'useValuesFromTriggerTime' on {@link Event} 1326 * allows a model to indicate the time at which the event's assignments 1327 * are intended to be evaluated. In SBML Level 2, the attribute has 1328 * a default value of <code>true</code>, which corresponds to the interpretation of 1329 * event assignments prior to Version 4: the values of the 1330 * assignment formulas are computed at the moment the event is triggered, 1331 * not after the delay. If 'useValuesFromTriggerTime'=<code>false</code>, it means 1332 * that the formulas in the event's assignments are to be computed after 1333 * the delay, at the time the event is executed. In SBML Level 3, 1334 * the attribute is mandatory, not optional, and all events must specify 1335 * a value for it. 1336 <p> 1337 * <p> 1338 * @return integer value indicating success/failure of the 1339 * function. The possible values 1340 * returned by this function are: 1341 * <ul> 1342 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1343 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1344 * 1345 * </ul> <p> 1346 * <p> 1347 * @warning <span class='warning'>The attribute 'useValuesFromTriggerTime' 1348 * was introduced in SBML Level 2 Version 4. It is not valid in 1349 * models defined using SBML Level 2 versions prior to Version 4. 1350 * If a Level 2 Version 1–3 model sets the attribute, the 1351 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 1352 * an error.</span> 1353 */ public unsetUseValuesFromTriggerTime()1354 int unsetUseValuesFromTriggerTime() { 1355 return libsbmlJNI.Event_unsetUseValuesFromTriggerTime(swigCPtr, this); 1356 } 1357 1358 1359 /** 1360 * Unsets the {@link Delay} of this {@link Event}. 1361 <p> 1362 * <p> 1363 * @return integer value indicating success/failure of the 1364 * function. The possible values 1365 * returned by this function are: 1366 * <ul> 1367 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1368 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1369 * </ul> 1370 */ public unsetDelay()1371 int unsetDelay() { 1372 return libsbmlJNI.Event_unsetDelay(swigCPtr, this); 1373 } 1374 1375 1376 /** 1377 * (SBML Level 3 only) Unsets the {@link Priority} of this {@link Event}. 1378 <p> 1379 * <p> 1380 * @return integer value indicating success/failure of the 1381 * function. The possible values 1382 * returned by this function are: 1383 * <ul> 1384 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1385 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1386 * 1387 * </ul> <p> 1388 * @note The element 'priority' is available in SBML Level 3, 1389 * but is not present in lower Levels of SBML. 1390 */ public unsetPriority()1391 int unsetPriority() { 1392 return libsbmlJNI.Event_unsetPriority(swigCPtr, this); 1393 } 1394 1395 1396 /** 1397 * Unsets the {@link Trigger} of this {@link Event}. 1398 <p> 1399 * <p> 1400 * @return integer value indicating success/failure of the 1401 * function. The possible values 1402 * returned by this function are: 1403 * <ul> 1404 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1405 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1406 * 1407 * </ul> <p> 1408 * @note The element 'priority' is available in SBML Level 3, 1409 * but is not present in lower Levels of SBML. 1410 */ public unsetTrigger()1411 int unsetTrigger() { 1412 return libsbmlJNI.Event_unsetTrigger(swigCPtr, this); 1413 } 1414 1415 1416 /** 1417 * Unsets the 'timeUnits' attribute of this {@link Event}. 1418 <p> 1419 * <p> 1420 * @return integer value indicating success/failure of the 1421 * function. The possible values 1422 * returned by this function are: 1423 * <ul> 1424 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1425 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 1426 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1427 * 1428 * </ul> <p> 1429 * <p> 1430 * @warning <span class='warning'>Definitions of {@link Event} in SBML Level 2 1431 * Versions 1 and 2 included the additional attribute called 1432 * 'timeUnits', but it was removed in SBML Level 2 Version 3. 1433 * LibSBML supports this attribute for compatibility with previous versions 1434 * of SBML Level 2, but its use is discouraged since models in 1435 * Level 2 Versions 3 and 4 cannot contain it. If a 1436 * Version 3 or 4 model sets the attribute, the 1437 * consistency-checking method {@link SBMLDocument#checkConsistency()} will report 1438 * an error.</span> 1439 */ public unsetTimeUnits()1440 int unsetTimeUnits() { 1441 return libsbmlJNI.Event_unsetTimeUnits(swigCPtr, this); 1442 } 1443 1444 1445 /** 1446 * Appends a copy of the given {@link EventAssignment} to this {@link Event}. 1447 <p> 1448 * @param ea the {@link EventAssignment} object to add. 1449 <p> 1450 * <p> 1451 * @return integer value indicating success/failure of the 1452 * function. The possible values 1453 * returned by this function are: 1454 * <ul> 1455 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 1456 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 1457 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 1458 * <li> {@link libsbmlConstants#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID} 1459 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 1460 * 1461 * </ul> <p> 1462 * <p> 1463 * @note This method should be used with some caution. The fact that this 1464 * method <em>copies</em> the object passed to it means that the caller will be 1465 * left holding a physically different object instance than the one contained 1466 * inside this object. Changes made to the original object instance (such as 1467 * resetting attribute values) will <em>not affect the instance in this 1468 * object</em>. In addition, the caller should make sure to free the 1469 * original object if it is no longer being used, or else a memory leak will 1470 * result. Please see other methods on this class (particularly a 1471 * corresponding method whose name begins with the word <code>create</code>) 1472 * for alternatives that do not lead to these issues. 1473 <p> 1474 * @see #createEventAssignment() 1475 */ public addEventAssignment(EventAssignment ea)1476 int addEventAssignment(EventAssignment ea) { 1477 return libsbmlJNI.Event_addEventAssignment(swigCPtr, this, EventAssignment.getCPtr(ea), ea); 1478 } 1479 1480 1481 /** 1482 * Creates a new, empty {@link EventAssignment}, adds it to this {@link Event}'s list of 1483 * event assignments and returns the {@link EventAssignment}. 1484 <p> 1485 * @return the newly created {@link EventAssignment} object instance. 1486 <p> 1487 * @see #addEventAssignment(EventAssignment ea) 1488 */ public createEventAssignment()1489 EventAssignment createEventAssignment() { 1490 long cPtr = libsbmlJNI.Event_createEventAssignment(swigCPtr, this); 1491 return (cPtr == 0) ? null : new EventAssignment(cPtr, false); 1492 } 1493 1494 1495 /** 1496 * Creates a new, empty {@link Trigger}, adds it to this {@link Event} and 1497 * returns the {@link Trigger}. 1498 <p> 1499 * @return the newly created {@link Trigger} object instance. 1500 */ public createTrigger()1501 Trigger createTrigger() { 1502 long cPtr = libsbmlJNI.Event_createTrigger(swigCPtr, this); 1503 return (cPtr == 0) ? null : new Trigger(cPtr, false); 1504 } 1505 1506 1507 /** 1508 * Creates a new, empty {@link Delay}, adds it to this {@link Event} and 1509 * returns the {@link Delay}. 1510 <p> 1511 * @return the newly created {@link Delay} object instance. 1512 */ public createDelay()1513 Delay createDelay() { 1514 long cPtr = libsbmlJNI.Event_createDelay(swigCPtr, this); 1515 return (cPtr == 0) ? null : new Delay(cPtr, false); 1516 } 1517 1518 1519 /** 1520 * (SBML Level 3 only) Creates a new, empty {@link Priority}, adds it to this 1521 * {@link Event} and returns the {@link Priority}. 1522 <p> 1523 * @return the newly created {@link Priority} object instance, or <code>null</code> if the SBML 1524 * level and version used for this {@link Event} does not define {@link Priority} children. 1525 <p> 1526 * @note The element 'priority' is available in SBML Level 3, 1527 * but is not present in lower Levels of SBML. 1528 */ public createPriority()1529 Priority createPriority() { 1530 long cPtr = libsbmlJNI.Event_createPriority(swigCPtr, this); 1531 return (cPtr == 0) ? null : new Priority(cPtr, false); 1532 } 1533 1534 1535 /** 1536 * Returns the list of event assignments for this {@link Event}. 1537 <p> 1538 * @return the list of EventAssignments for this {@link Event}. 1539 */ public getListOfEventAssignments()1540 ListOfEventAssignments getListOfEventAssignments() { 1541 long cPtr = libsbmlJNI.Event_getListOfEventAssignments__SWIG_0(swigCPtr, this); 1542 return (cPtr == 0) ? null : new ListOfEventAssignments(cPtr, false); 1543 } 1544 1545 1546 /** 1547 * Return a specific {@link EventAssignment} object of this {@link Event}. 1548 <p> 1549 * @param n an integer, the index of the {@link EventAssignment} object to return. 1550 <p> 1551 * @return the <code>n</code>th {@link EventAssignment} of this {@link Event}. 1552 */ public getEventAssignment(long n)1553 EventAssignment getEventAssignment(long n) { 1554 long cPtr = libsbmlJNI.Event_getEventAssignment__SWIG_0(swigCPtr, this, n); 1555 return (cPtr == 0) ? null : new EventAssignment(cPtr, false); 1556 } 1557 1558 1559 /** 1560 * Return the event assignment indicated by the given <code>variable</code>. 1561 <p> 1562 * @param variable a string, the identifier of the variable whose 1563 * {@link EventAssignment} is being sought. 1564 <p> 1565 * @return the {@link EventAssignment} for the given <code>variable</code>, or <code>null</code> if 1566 * no such {@link EventAssignment} exists. 1567 */ public getEventAssignment(String variable)1568 EventAssignment getEventAssignment(String variable) { 1569 long cPtr = libsbmlJNI.Event_getEventAssignment__SWIG_2(swigCPtr, this, variable); 1570 return (cPtr == 0) ? null : new EventAssignment(cPtr, false); 1571 } 1572 1573 1574 /** 1575 * Returns the number of {@link EventAssignment} objects attached to this 1576 * {@link Event}. 1577 <p> 1578 * @return the number of EventAssignments in this {@link Event}. 1579 */ public getNumEventAssignments()1580 long getNumEventAssignments() { 1581 return libsbmlJNI.Event_getNumEventAssignments(swigCPtr, this); 1582 } 1583 1584 1585 /** 1586 * Removes the nth {@link EventAssignment} object from this {@link Event} object and 1587 * returns a pointer to it. 1588 <p> 1589 * The caller owns the returned object and is responsible for deleting it. 1590 <p> 1591 * @param n the index of the {@link EventAssignment} object to remove. 1592 <p> 1593 * @return the {@link EventAssignment} object removed. As mentioned above, 1594 * the caller owns the returned item. <code>null</code> is returned if the given index 1595 * is out of range. 1596 */ public removeEventAssignment(long n)1597 EventAssignment removeEventAssignment(long n) { 1598 long cPtr = libsbmlJNI.Event_removeEventAssignment__SWIG_0(swigCPtr, this, n); 1599 return (cPtr == 0) ? null : new EventAssignment(cPtr, true); 1600 } 1601 1602 1603 /** 1604 * Removes the {@link EventAssignment} object with the given 'variable' attribute 1605 * from this {@link Event} object and returns a pointer to it. 1606 <p> 1607 * The caller owns the returned object and is responsible for deleting it. 1608 * If none of the {@link EventAssignment} objects in this {@link Event} object have the 1609 * 'variable' attribute <code>variable</code>, then <code>null</code> is returned. 1610 <p> 1611 * @param variable the 'variable' attribute of the {@link EventAssignment} object 1612 * to remove. 1613 <p> 1614 * @return the {@link EventAssignment} object removed. As mentioned above, the 1615 * caller owns the returned object. <code>null</code> is returned if no {@link EventAssignment} 1616 * object with the 'variable' attribute exists in this {@link Event} object. 1617 */ public removeEventAssignment(String variable)1618 EventAssignment removeEventAssignment(String variable) { 1619 long cPtr = libsbmlJNI.Event_removeEventAssignment__SWIG_1(swigCPtr, this, variable); 1620 return (cPtr == 0) ? null : new EventAssignment(cPtr, true); 1621 } 1622 connectToChild()1623 public void connectToChild() { 1624 libsbmlJNI.Event_connectToChild(swigCPtr, this); 1625 } 1626 1627 1628 /** * @internal */ public enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag)1629 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 1630 libsbmlJNI.Event_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 1631 } 1632 1633 1634 /** * @internal */ public updateSBMLNamespace(String _package, long level, long version)1635 void updateSBMLNamespace(String _package, long level, long version) { 1636 libsbmlJNI.Event_updateSBMLNamespace(swigCPtr, this, _package, level, version); 1637 } 1638 1639 1640 /** 1641 * Returns the libSBML type code of this object instance. 1642 <p> 1643 * <p> 1644 * LibSBML attaches an identifying code to every kind of SBML object. These 1645 * are integer constants known as <em>SBML type codes</em>. The names of all 1646 * the codes begin with the characters <code>SBML_</code>. 1647 * In the Java language interface for libSBML, the 1648 * type codes are defined as static integer constants in the interface class 1649 * {@link libsbmlConstants}. Note that different Level 3 1650 * package plug-ins may use overlapping type codes; to identify the package 1651 * to which a given object belongs, call the 1652 * <code>{@link SBase#getPackageName()} 1653 * </code> 1654 * method on the object. 1655 <p> 1656 * The exception to this is lists: all SBML-style list elements have the type 1657 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF}, regardless of what package they 1658 * are from. 1659 <p> 1660 * @return the SBML type code for this object: 1661 * {@link libsbmlConstants#SBML_EVENT SBML_EVENT} (default). 1662 <p> 1663 * <p> 1664 * @warning <span class='warning'>The specific integer values of the possible 1665 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 1666 * packages, To fully identify the correct code, <strong>it is necessary to 1667 * invoke both getPackageName() and getTypeCode()</strong> (or 1668 * {@link ListOf#getItemTypeCode()}).</span> 1669 <p> 1670 * @see #getElementName() 1671 * @see #getPackageName() 1672 */ public getTypeCode()1673 int getTypeCode() { 1674 return libsbmlJNI.Event_getTypeCode(swigCPtr, this); 1675 } 1676 1677 1678 /** 1679 * Returns the XML element name of this object, which for {@link Event}, is 1680 * always <code>'event'.</code> 1681 <p> 1682 * @return the name of this element, i.e., <code>'event'.</code> 1683 */ public getElementName()1684 String getElementName() { 1685 return libsbmlJNI.Event_getElementName(swigCPtr, this); 1686 } 1687 1688 1689 /** 1690 * Predicate returning <code>true</code> if all the required attributes for this 1691 * {@link Event} object have been set. 1692 <p> 1693 * The required attributes for an {@link Event} object are: 1694 * <ul> 1695 * <li> 'useValuesfromTriggerTime' (required in SBML Level 3) 1696 * 1697 * </ul> <p> 1698 * @return <code>true</code> if the required attributes have been set, <code>false</code> 1699 * otherwise. 1700 */ public hasRequiredAttributes()1701 boolean hasRequiredAttributes() { 1702 return libsbmlJNI.Event_hasRequiredAttributes(swigCPtr, this); 1703 } 1704 1705 1706 /** 1707 * Predicate returning <code>true</code> if all the required elements for this {@link Event} 1708 * object have been set. 1709 <p> 1710 * @note The required elements for an {@link Event} object are: 1711 * <ul> 1712 * <li> 'trigger' (required in SBML Level 2 and Level 3 Version 1; 1713 * optional in SBML Level 3 Version 2+ 1714 * <li> 'listOfEventAssignments' (required in SBML Level 2; optional in Level 3) 1715 * </ul> 1716 */ public hasRequiredElements()1717 boolean hasRequiredElements() { 1718 return libsbmlJNI.Event_hasRequiredElements(swigCPtr, this); 1719 } 1720 1721 } 1722