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