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 * Parent class for libSBML's 'ListOfXYZ' classes. 13 <p> 14 * <p style='color: #777; font-style: italic'> 15 This class of objects is defined by libSBML only and has no direct 16 equivalent in terms of SBML components. This class is not prescribed by 17 the SBML specifications, although it is used to implement features 18 defined in SBML. 19 </p> 20 21 <p> 22 * The {@link ListOf} class in libSBML is a utility class that serves as the parent 23 * class for implementing the ListOf__ classes. It provides methods for 24 * working generically with the various SBML lists of objects in a program. 25 * LibSBML uses this separate list class rather than ordinary 26 * Java lists, 27 * so that it can provide the methods and features associated with {@link SBase}. 28 <p> 29 * Whether a given {@link ListOf} element may be empty or not depends on the 30 * element in question, and on what level and version of SBML it 31 * is being used for. For {@link ListOf} elements in SBML Level 3 32 * Version 1 and prior, no core list and few package lists could 33 * be empty. As of SBML Level 3 Version 2, the rules 34 * were relaxed, and lists were allowed to be empty. In libSBML, 35 * documents created for Level 3 Version 2 will be written 36 * with empty {@link ListOf}'s if that {@link ListOf} contains some other 'extra' 37 * information: an attribute such as metaid or sboTerm, a child 38 * '<notes>' or '<annotation>', or information from a SBML 39 * Level 3 package. 40 <p> 41 * <p> 42 * The various ListOf___ classes in SBML 43 * are merely containers used for organizing the main components of an SBML 44 * model. In libSBML's implementation, ListOf___ 45 * classes are derived from the 46 * intermediate utility class {@link ListOf}, which 47 * is not defined by the SBML specifications but serves as a useful 48 * programmatic construct. {@link ListOf} is itself is in turn derived from {@link SBase}, 49 * which provides all of the various ListOf___ 50 * classes with common features 51 * defined by the SBML specification, such as 'metaid' attributes and 52 * annotations. 53 <p> 54 * The relationship between the lists and the rest of an SBML model is 55 * illustrated by the following (for SBML Level 2 Version 4): 56 <p> 57 * <figure> 58 <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object> 59 </figure> 60 61 <p> 62 * SBML Level 3 Version 1 has essentially the same structure as 63 * Level 2 Version 4, depicted above, but SBML Level 3 64 * Version 2 allows 65 * containers to contain zero or more of the relevant object, instead of 66 * requiring at least one. As such, libsbml will write out an 67 * otherwise-empty ListOf___ element that has any optional attribute set 68 * (such as 'id' or 'metaid'), that has an optional child (such 69 * as a 'notes' or 'annotation'), or that has attributes or children set 70 * from any SBML Level 3 package, whether or not the ListOf___ has 71 * any other children. 72 <p> 73 * Readers may wonder about the motivations for using the ListOf___ 74 * containers in SBML. A simpler approach in XML might be to place the 75 * components all directly at the top level of the model definition. The 76 * choice made in SBML is to group them within XML elements named after 77 * ListOf<em>Classname</em>, in part because it helps organize the 78 * components. More importantly, the fact that the container classes are 79 * derived from {@link SBase} means that software tools can add information <em>about</em> 80 * the lists themselves into each list container's 'annotation'. 81 <p> 82 * @see ListOfFunctionDefinitions 83 * @see ListOfUnitDefinitions 84 * @see ListOfCompartmentTypes 85 * @see ListOfSpeciesTypes 86 * @see ListOfCompartments 87 * @see ListOfSpecies 88 * @see ListOfParameters 89 * @see ListOfInitialAssignments 90 * @see ListOfRules 91 * @see ListOfConstraints 92 * @see ListOfReactions 93 * @see ListOfEvents 94 */ 95 96 public class ListOf extends SBase { 97 private long swigCPtr; 98 ListOf(long cPtr, boolean cMemoryOwn)99 protected ListOf(long cPtr, boolean cMemoryOwn) 100 { 101 super(libsbmlJNI.ListOf_SWIGUpcast(cPtr), cMemoryOwn); 102 swigCPtr = cPtr; 103 } 104 getCPtr(ListOf obj)105 protected static long getCPtr(ListOf obj) 106 { 107 return (obj == null) ? 0 : obj.swigCPtr; 108 } 109 getCPtrAndDisown(ListOf obj)110 protected static long getCPtrAndDisown (ListOf obj) 111 { 112 long ptr = 0; 113 114 if (obj != null) 115 { 116 ptr = obj.swigCPtr; 117 obj.swigCMemOwn = false; 118 } 119 120 return ptr; 121 } 122 123 @SuppressWarnings("deprecation") finalize()124 protected void finalize() { 125 delete(); 126 } 127 delete()128 public synchronized void delete() { 129 if (swigCPtr != 0) { 130 if (swigCMemOwn) { 131 swigCMemOwn = false; 132 libsbmlJNI.delete_ListOf(swigCPtr); 133 } 134 swigCPtr = 0; 135 } 136 super.delete(); 137 } 138 139 140 /** 141 * Creates a new {@link ListOf} object. 142 <p> 143 * @param level the SBML Level; if not assigned, defaults to the 144 * value of {@link SBMLDocument#getDefaultLevel()}. 145 <p> 146 * @param version the Version within the SBML Level; if not assigned, 147 * defaults to the value of {@link SBMLDocument#getDefaultVersion()}. 148 <p> 149 * <p> 150 * @note Bare {@link ListOf} objects are 151 * impossible to add to SBML models. The {@link ListOf} 152 * class is simply the base 153 * of <em>other</em> classes in 154 * libSBML. Calling programs are not intended to create bare {@link ListOf} 155 * objects themselves. 156 <p> 157 * <p> 158 * @note Attempting to add an object to an {@link SBMLDocument} having a different 159 * combination of SBML Level, Version and XML namespaces than the object 160 * itself will result in an error at the time a caller attempts to make the 161 * addition. A parent object must have compatible Level, Version and XML 162 * namespaces. (Strictly speaking, a parent may also have more XML 163 * namespaces than a child, but the reverse is not permitted.) The 164 * restriction is necessary to ensure that an SBML model has a consistent 165 * overall structure. This requires callers to manage their objects 166 * carefully, but the benefit is increased flexibility in how models can be 167 * created by permitting callers to create objects bottom-up if desired. In 168 * situations where objects are not yet attached to parents (e.g., 169 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 170 * libSBML determine such things as whether it is valid to assign a 171 * particular value to an attribute. 172 <p> 173 * 174 </dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 175 The native C++ implementation of this method defines a default argument 176 value. In the documentation generated for different libSBML language 177 bindings, you may or may not see corresponding arguments in the method 178 declarations. For example, in Java and C#, a default argument is handled by 179 declaring two separate methods, with one of them having the argument and 180 the other one lacking the argument. However, the libSBML documentation will 181 be <em>identical</em> for both methods. Consequently, if you are reading 182 this and do not see an argument even though one is described, please look 183 for descriptions of other variants of this method near where this one 184 appears in the documentation. 185 </dd></dl> 186 187 */ public ListOf(long level, long version)188 ListOf(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 189 this(libsbmlJNI.new_ListOf__SWIG_0(level, version), true); 190 } 191 192 193 /** 194 * Creates a new {@link ListOf} object. 195 <p> 196 * @param level the SBML Level; if not assigned, defaults to the 197 * value of {@link SBMLDocument#getDefaultLevel()}. 198 <p> 199 * @param version the Version within the SBML Level; if not assigned, 200 * defaults to the value of {@link SBMLDocument#getDefaultVersion()}. 201 <p> 202 * <p> 203 * @note Bare {@link ListOf} objects are 204 * impossible to add to SBML models. The {@link ListOf} 205 * class is simply the base 206 * of <em>other</em> classes in 207 * libSBML. Calling programs are not intended to create bare {@link ListOf} 208 * objects themselves. 209 <p> 210 * <p> 211 * @note Attempting to add an object to an {@link SBMLDocument} having a different 212 * combination of SBML Level, Version and XML namespaces than the object 213 * itself will result in an error at the time a caller attempts to make the 214 * addition. A parent object must have compatible Level, Version and XML 215 * namespaces. (Strictly speaking, a parent may also have more XML 216 * namespaces than a child, but the reverse is not permitted.) The 217 * restriction is necessary to ensure that an SBML model has a consistent 218 * overall structure. This requires callers to manage their objects 219 * carefully, but the benefit is increased flexibility in how models can be 220 * created by permitting callers to create objects bottom-up if desired. In 221 * situations where objects are not yet attached to parents (e.g., 222 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 223 * libSBML determine such things as whether it is valid to assign a 224 * particular value to an attribute. 225 <p> 226 * 227 </dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 228 The native C++ implementation of this method defines a default argument 229 value. In the documentation generated for different libSBML language 230 bindings, you may or may not see corresponding arguments in the method 231 declarations. For example, in Java and C#, a default argument is handled by 232 declaring two separate methods, with one of them having the argument and 233 the other one lacking the argument. However, the libSBML documentation will 234 be <em>identical</em> for both methods. Consequently, if you are reading 235 this and do not see an argument even though one is described, please look 236 for descriptions of other variants of this method near where this one 237 appears in the documentation. 238 </dd></dl> 239 240 */ public ListOf(long level)241 ListOf(long level) throws org.sbml.libsbml.SBMLConstructorException { 242 this(libsbmlJNI.new_ListOf__SWIG_1(level), true); 243 } 244 245 246 /** 247 * Creates a new {@link ListOf} object. 248 <p> 249 * @param level the SBML Level; if not assigned, defaults to the 250 * value of {@link SBMLDocument#getDefaultLevel()}. 251 <p> 252 * @param version the Version within the SBML Level; if not assigned, 253 * defaults to the value of {@link SBMLDocument#getDefaultVersion()}. 254 <p> 255 * <p> 256 * @note Bare {@link ListOf} objects are 257 * impossible to add to SBML models. The {@link ListOf} 258 * class is simply the base 259 * of <em>other</em> classes in 260 * libSBML. Calling programs are not intended to create bare {@link ListOf} 261 * objects themselves. 262 <p> 263 * <p> 264 * @note Attempting to add an object to an {@link SBMLDocument} having a different 265 * combination of SBML Level, Version and XML namespaces than the object 266 * itself will result in an error at the time a caller attempts to make the 267 * addition. A parent object must have compatible Level, Version and XML 268 * namespaces. (Strictly speaking, a parent may also have more XML 269 * namespaces than a child, but the reverse is not permitted.) The 270 * restriction is necessary to ensure that an SBML model has a consistent 271 * overall structure. This requires callers to manage their objects 272 * carefully, but the benefit is increased flexibility in how models can be 273 * created by permitting callers to create objects bottom-up if desired. In 274 * situations where objects are not yet attached to parents (e.g., 275 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 276 * libSBML determine such things as whether it is valid to assign a 277 * particular value to an attribute. 278 <p> 279 * 280 </dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 281 The native C++ implementation of this method defines a default argument 282 value. In the documentation generated for different libSBML language 283 bindings, you may or may not see corresponding arguments in the method 284 declarations. For example, in Java and C#, a default argument is handled by 285 declaring two separate methods, with one of them having the argument and 286 the other one lacking the argument. However, the libSBML documentation will 287 be <em>identical</em> for both methods. Consequently, if you are reading 288 this and do not see an argument even though one is described, please look 289 for descriptions of other variants of this method near where this one 290 appears in the documentation. 291 </dd></dl> 292 293 */ public ListOf()294 ListOf() throws org.sbml.libsbml.SBMLConstructorException { 295 this(libsbmlJNI.new_ListOf__SWIG_2(), true); 296 } 297 298 299 /** 300 * Creates a new {@link ListOf} with a given {@link SBMLNamespaces} object. 301 <p> 302 * @param sbmlns the set of SBML namespaces that this {@link ListOf} should 303 * contain. 304 <p> 305 * <p> 306 * @note Bare {@link ListOf} objects are 307 * impossible to add to SBML models. The {@link ListOf} 308 * class is simply the base 309 * of <em>other</em> classes in 310 * libSBML. Calling programs are not intended to create bare {@link ListOf} 311 * objects themselves. 312 <p> 313 * <p> 314 * @note Attempting to add an object to an {@link SBMLDocument} having a different 315 * combination of SBML Level, Version and XML namespaces than the object 316 * itself will result in an error at the time a caller attempts to make the 317 * addition. A parent object must have compatible Level, Version and XML 318 * namespaces. (Strictly speaking, a parent may also have more XML 319 * namespaces than a child, but the reverse is not permitted.) The 320 * restriction is necessary to ensure that an SBML model has a consistent 321 * overall structure. This requires callers to manage their objects 322 * carefully, but the benefit is increased flexibility in how models can be 323 * created by permitting callers to create objects bottom-up if desired. In 324 * situations where objects are not yet attached to parents (e.g., 325 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 326 * libSBML determine such things as whether it is valid to assign a 327 * particular value to an attribute. 328 */ public ListOf(SBMLNamespaces sbmlns)329 ListOf(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 330 this(libsbmlJNI.new_ListOf__SWIG_3(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 331 } 332 333 334 /** 335 * Copy constructor; creates a copy of this {@link ListOf}. 336 <p> 337 * @param orig the {@link ListOf} instance to copy. 338 */ public ListOf(ListOf orig)339 ListOf(ListOf orig) throws org.sbml.libsbml.SBMLConstructorException { 340 this(libsbmlJNI.new_ListOf__SWIG_4(ListOf.getCPtr(orig), orig), true); 341 } 342 343 344 /** 345 * Creates and returns a deep copy of this {@link ListOf} object. 346 <p> 347 * @return the (deep) copy of this {@link ListOf} object. 348 */ public cloneObject()349 ListOf cloneObject() { 350 long cPtr = libsbmlJNI.ListOf_cloneObject(swigCPtr, this); 351 return (cPtr == 0) ? null : new ListOf(cPtr, true); 352 } 353 354 355 /** 356 * Adds an item to the end of this {@link ListOf}'s list of items. 357 <p> 358 * This method makes a clone of the <code>item</code> handed to it. This means that 359 * when the {@link ListOf} object is destroyed, the original items will not be 360 * destroyed. For a method with an alternative ownership behavior, see the 361 * {@link ListOf#appendAndOwn(SBase)} method. 362 <p> 363 * @param item the item to be added to the list. 364 <p> 365 * <p> 366 * @return integer value indicating success/failure of the 367 * function. The possible values 368 * returned by this function are: 369 * <ul> 370 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 371 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 372 * 373 * </ul> <p> 374 * @see #appendAndOwn(SBase disownedItem) 375 * @see #appendFrom(ListOf list) 376 */ public append(SBase item)377 int append(SBase item) { 378 return libsbmlJNI.ListOf_append(swigCPtr, this, SBase.getCPtr(item), item); 379 } 380 381 382 /** 383 * Adds an item to the end of this {@link ListOf}'s list of items. 384 <p> 385 * This method does not clone the <code>disownedItem</code> handed to it; instead, it assumes 386 * ownership of it. This means that when the {@link ListOf} is destroyed, the item 387 * will be destroyed along with it. For a method with an alternative 388 * ownership behavior, see the {@link ListOf#append(SBase item)} method. 389 <p> 390 * @param disownedItem the item to be added to the list. 391 * Will become a child of the parent list. 392 <p> 393 * <p> 394 * @return integer value indicating success/failure of the 395 * function. The possible values 396 * returned by this function are: 397 * <ul> 398 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 399 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 400 * 401 * </ul> <p> 402 * @see #append(SBase item) 403 * @see #appendFrom(ListOf list) 404 */ public appendAndOwn(SBase disownedItem)405 int appendAndOwn(SBase disownedItem) { 406 return libsbmlJNI.ListOf_appendAndOwn(swigCPtr, this, SBase.getCPtrAndDisown(disownedItem), disownedItem); 407 } 408 409 410 /** 411 * Adds a clone of a list of items to this {@link ListOf}'s list. 412 <p> 413 * Note that because this clones the objects handed to it, the original 414 * items will not be destroyed when this {@link ListOf} object is destroyed. 415 <p> 416 * @param list a list of items to be added. 417 <p> 418 * <p> 419 * @return integer value indicating success/failure of the 420 * function. The possible values 421 * returned by this function are: 422 * <ul> 423 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 424 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 425 * 426 * </ul> <p> 427 * @see #append(SBase item) 428 * @see #appendAndOwn(SBase disownedItem) 429 */ public appendFrom(ListOf list)430 int appendFrom(ListOf list) { 431 return libsbmlJNI.ListOf_appendFrom(swigCPtr, this, ListOf.getCPtr(list), list); 432 } 433 434 435 /** 436 * Inserts an item at a given position in this {@link ListOf}'s list of items. 437 <p> 438 * This variant of the method makes a clone of the <code>item</code> handed to it. 439 * This means that when the {@link ListOf} is destroyed, the original <code>item</code> will 440 * <em>not</em> be destroyed. 441 <p> 442 * @param location the location in the list where to insert the item. 443 * @param item the item to be inserted to the list. 444 <p> 445 * <p> 446 * @return integer value indicating success/failure of the 447 * function. The possible values 448 * returned by this function are: 449 * <ul> 450 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 451 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 452 * 453 * </ul> <p> 454 * @see #insertAndOwn(int location, SBase item) 455 */ public insert(int location, SBase item)456 int insert(int location, SBase item) { 457 return libsbmlJNI.ListOf_insert(swigCPtr, this, location, SBase.getCPtr(item), item); 458 } 459 460 461 /** 462 * Inserts an item at a given position in this {@link ListOf}'s list of items. 463 <p> 464 * This variant of the method does not make a clone of the <code>disownedItem</code> handed to it. 465 * This means that when the {@link ListOf} is destroyed, the original <code>item</code> 466 * <em>will</em> be destroyed. 467 <p> 468 * @param location the location where to insert the item. 469 * @param disownedItem the item to be inserted to the list. 470 * Will become a child of the parent list. 471 <p> 472 * <p> 473 * @return integer value indicating success/failure of the 474 * function. The possible values 475 * returned by this function are: 476 * <ul> 477 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 478 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 479 * 480 * </ul> <p> 481 * @see #insert(int location, SBase item) 482 */ public insertAndOwn(int location, SBase disownedItem)483 int insertAndOwn(int location, SBase disownedItem) { 484 return libsbmlJNI.ListOf_insertAndOwn(swigCPtr, this, location, SBase.getCPtrAndDisown(disownedItem), disownedItem); 485 } 486 487 488 /** 489 * Get an item from the list. 490 <p> 491 * @param n the index number of the item to get. 492 <p> 493 * @return the <em>n</em>th item in this {@link ListOf} items, or a null pointer if 494 * the index number <code>n</code> refers to a nonexistent position in this list. 495 <p> 496 * @see #size() 497 */ public get(long n)498 SBase get(long n) { 499 return libsbml.DowncastSBase(libsbmlJNI.ListOf_get__SWIG_0(swigCPtr, this, n), false); 500 } 501 502 503 /** 504 * Returns the first child element found that has the given identifier. 505 <p> 506 * This method searches this {@link ListOf}'s list of items for SBML objects based 507 * on their 'id' attribute value in the model-wide <code>SId</code> 508 * identifier namespace. 509 <p> 510 * @param id string representing the id of the object to find. 511 <p> 512 * @return the first element found with the given <code>id</code>, or <code>null</code> if no 513 * such object is found. 514 */ public getElementBySId(String id)515 SBase getElementBySId(String id) { 516 return libsbml.DowncastSBase(libsbmlJNI.ListOf_getElementBySId(swigCPtr, this, id), false); 517 } 518 519 520 /** 521 * Returns the first child element found with the given meta-identifier. 522 <p> 523 * @param metaid string representing the 'metaid' attribute of the object 524 * to find. 525 <p> 526 * @return the first element found with the given <code>metaid</code>, or <code>null</code> if 527 * no such object is found. 528 */ public getElementByMetaId(String metaid)529 SBase getElementByMetaId(String metaid) { 530 return libsbml.DowncastSBase(libsbmlJNI.ListOf_getElementByMetaId(swigCPtr, this, metaid), false); 531 } 532 533 534 /** 535 * Removes all items in this {@link ListOf} object. 536 <p> 537 * If parameter <code>doDelete</code> is <code>true</code> (default), all items in this {@link ListOf} 538 * object are deleted and cleared, and thus the caller doesn't have to 539 * delete those items. Otherwise, all items are cleared only from this 540 * {@link ListOf} object; the caller is still responsible for deleting the actual 541 * items. (In the latter case, callers are advised to store pointers to 542 * all items elsewhere before calling this function.) 543 <p> 544 * @param doDelete if <code>true</code> (default), all items are deleted and cleared. 545 * Otherwise, all items are just cleared and not deleted. 546 <p> 547 * 548 </dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 549 The native C++ implementation of this method defines a default argument 550 value. In the documentation generated for different libSBML language 551 bindings, you may or may not see corresponding arguments in the method 552 declarations. For example, in Java and C#, a default argument is handled by 553 declaring two separate methods, with one of them having the argument and 554 the other one lacking the argument. However, the libSBML documentation will 555 be <em>identical</em> for both methods. Consequently, if you are reading 556 this and do not see an argument even though one is described, please look 557 for descriptions of other variants of this method near where this one 558 appears in the documentation. 559 </dd></dl> 560 561 */ public clear(boolean doDelete)562 void clear(boolean doDelete) { 563 libsbmlJNI.ListOf_clear__SWIG_0(swigCPtr, this, doDelete); 564 } 565 566 567 /** 568 * Removes all items in this {@link ListOf} object. 569 <p> 570 * If parameter <code>doDelete</code> is <code>true</code> (default), all items in this {@link ListOf} 571 * object are deleted and cleared, and thus the caller doesn't have to 572 * delete those items. Otherwise, all items are cleared only from this 573 * {@link ListOf} object; the caller is still responsible for deleting the actual 574 * items. (In the latter case, callers are advised to store pointers to 575 * all items elsewhere before calling this function.) 576 <p> 577 * @param doDelete if <code>true</code> (default), all items are deleted and cleared. 578 * Otherwise, all items are just cleared and not deleted. 579 <p> 580 * 581 </dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 582 The native C++ implementation of this method defines a default argument 583 value. In the documentation generated for different libSBML language 584 bindings, you may or may not see corresponding arguments in the method 585 declarations. For example, in Java and C#, a default argument is handled by 586 declaring two separate methods, with one of them having the argument and 587 the other one lacking the argument. However, the libSBML documentation will 588 be <em>identical</em> for both methods. Consequently, if you are reading 589 this and do not see an argument even though one is described, please look 590 for descriptions of other variants of this method near where this one 591 appears in the documentation. 592 </dd></dl> 593 594 */ public clear()595 void clear() { 596 libsbmlJNI.ListOf_clear__SWIG_1(swigCPtr, this); 597 } 598 599 600 /** 601 * Removes all items in this {@link ListOf} object and deletes its properties too. 602 <p> 603 * This performs a call to clear() with an argument of <code>true</code> (thus removing 604 * all the child objects in the list), followed by calls to various libSBML 605 * <code>unset<em>Foo</em></code> methods to delete everything else: {@link CVTerm} 606 * objects, model history objects, etc. 607 <p> 608 * <p> 609 * @return integer value indicating success/failure of the 610 * function. The possible values 611 * returned by this function are: 612 * <ul> 613 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 614 * </ul> 615 */ public removeFromParentAndDelete()616 int removeFromParentAndDelete() { 617 return libsbmlJNI.ListOf_removeFromParentAndDelete(swigCPtr, this); 618 } 619 620 621 /** 622 * Removes the <em>n</em>th item from this {@link ListOf} list of items and returns 623 * it. 624 <p> 625 * The caller owns the returned item and is responsible for deleting it. 626 <p> 627 * @param n the index of the item to remove. 628 <p> 629 * @see #size() 630 */ public remove(long n)631 SBase remove(long n) { 632 return libsbml.DowncastSBase(libsbmlJNI.ListOf_remove(swigCPtr, this, n), true); 633 } 634 635 636 /** 637 * Returns number of items in this {@link ListOf} list. 638 <p> 639 * @return the number of items in this {@link ListOf} items. 640 */ public size()641 long size() { 642 return libsbmlJNI.ListOf_size(swigCPtr, this); 643 } 644 connectToChild()645 public void connectToChild() { 646 libsbmlJNI.ListOf_connectToChild(swigCPtr, this); 647 } 648 649 650 /** 651 * Returns the libSBML type code for this object, namely, 652 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF}. 653 <p> 654 * <p> 655 * LibSBML attaches an identifying code to every kind of SBML object. These 656 * are integer constants known as <em>SBML type codes</em>. The names of all 657 * the codes begin with the characters <code>SBML_</code>. 658 * In the Java language interface for libSBML, the 659 * type codes are defined as static integer constants in the interface class 660 * {@link libsbmlConstants}. Note that different Level 3 661 * package plug-ins may use overlapping type codes; to identify the package 662 * to which a given object belongs, call the 663 * <code>{@link SBase#getPackageName()} 664 * </code> 665 * method on the object. 666 <p> 667 * The exception to this is lists: all SBML-style list elements have the type 668 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF}, regardless of what package they 669 * are from. 670 <p> 671 * @return the SBML type code for this object: 672 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} (default). 673 <p> 674 * @note The various {@link ListOf} classes mostly differ from each other in what they 675 * contain. Hence, one must call getItemTypeCode() to fully determine the 676 * class of this SBML object. 677 <p> 678 * <p> 679 * @warning <span class='warning'>The specific integer values of the possible 680 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 681 * packages, To fully identify the correct code, <strong>it is necessary to 682 * invoke both getPackageName() and getTypeCode()</strong> (or 683 * {@link ListOf#getItemTypeCode()}).</span> 684 <p> 685 * @see #getItemTypeCode() 686 * @see #getElementName() 687 * @see #getPackageName() 688 */ public getTypeCode()689 int getTypeCode() { 690 return libsbmlJNI.ListOf_getTypeCode(swigCPtr, this); 691 } 692 693 694 /** 695 * Get the type code of the objects contained in this {@link ListOf}. 696 <p> 697 * <p> 698 * LibSBML attaches an identifying code to every kind of SBML object. These 699 * are integer constants known as <em>SBML type codes</em>. The names of all 700 * the codes begin with the characters <code>SBML_</code>. 701 * In the Java language interface for libSBML, the 702 * type codes are defined as static integer constants in the interface class 703 * {@link libsbmlConstants}. Note that different Level 3 704 * package plug-ins may use overlapping type codes; to identify the package 705 * to which a given object belongs, call the 706 * <code>{@link SBase#getPackageName()} 707 * </code> 708 * method on the object. 709 <p> 710 * The exception to this is lists: all SBML-style list elements have the type 711 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF}, regardless of what package they 712 * are from. 713 <p> 714 * Classes that inherit from the {@link ListOf} class should override this method 715 * to return the SBML type code for the objects contained in this {@link ListOf}. 716 * If they do not, this method will return 717 * {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN} 718 <p> 719 * @return The {@link ListOf} base class contains no SBML objects, and therefore 720 * this method returns {@link libsbmlConstants#SBML_UNKNOWN SBML_UNKNOWN}. 721 <p> 722 * @see #getElementName() 723 * @see #getPackageName() 724 */ public getItemTypeCode()725 int getItemTypeCode() { 726 return libsbmlJNI.ListOf_getItemTypeCode(swigCPtr, this); 727 } 728 729 730 /** 731 * Returns the XML element name of this object, which for {@link ListOf}, is 732 * always <code>'listOf'.</code> 733 <p> 734 * @return the XML name of this element. 735 */ public getElementName()736 String getElementName() { 737 return libsbmlJNI.ListOf_getElementName(swigCPtr, this); 738 } 739 740 741 /** * @internal */ public enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag)742 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 743 libsbmlJNI.ListOf_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 744 } 745 746 747 /** * @internal */ public updateSBMLNamespace(String _package, long level, long version)748 void updateSBMLNamespace(String _package, long level, long version) { 749 libsbmlJNI.ListOf_updateSBMLNamespace(swigCPtr, this, _package, level, version); 750 } 751 752 753 /** * @internal */ public hasOptionalElements()754 boolean hasOptionalElements() { 755 return libsbmlJNI.ListOf_hasOptionalElements(swigCPtr, this); 756 } 757 758 759 /** * @internal */ public isExplicitlyListed()760 boolean isExplicitlyListed() { 761 return libsbmlJNI.ListOf_isExplicitlyListed(swigCPtr, this); 762 } 763 764 765 /** * @internal */ public setExplicitlyListed(boolean value)766 void setExplicitlyListed(boolean value) { 767 libsbmlJNI.ListOf_setExplicitlyListed__SWIG_0(swigCPtr, this, value); 768 } 769 770 771 /** * @internal */ public setExplicitlyListed()772 void setExplicitlyListed() { 773 libsbmlJNI.ListOf_setExplicitlyListed__SWIG_1(swigCPtr, this); 774 } 775 776 777 /** * @internal */ public sort()778 void sort() { 779 libsbmlJNI.ListOf_sort(swigCPtr, this); 780 } 781 782 } 783