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 * <span class="pkg-marker pkg-color-groups"><a href="group__groups.html">groups</a></span> 013 A list of {@link Member} objects. 014 <p> 015 * In the SBML Level 3 Groups package, the membership of a group is 016 * defined by placing {@link Member} objects within a {@link ListOfMembers} object contained 017 * within a {@link Group} object. A {@link ListOfMembers} object is optional, but, if 018 * present, it must contain at least one {@link Member} object. In common with other 019 * ListOf___ classes in SBML, {@link ListOfMembers} is derived from {@link SBase}. However, 020 * an uncommon feature of {@link ListOfMembers} is that it has optional 'id' and 021 * 'name' attributes that can be used in a manner discussed below. 022 <p> 023 * A {@link ListOfMembers} must have one or more {@link Member} children. Since {@link ListOfMembers} 024 * is derived from {@link SBase}, it inherits the 'sboTerm' and 'metaid' attributes, 025 * as well as the optional children Notes and Annotation. Unlike most lists 026 * of objects in SBML, however, the 'sboTerm' attribute and the Notes and 027 * Annotation children are taken here to apply directly to every SBML element 028 * referenced by each child {@link Member} of this {@link ListOfMembers}, if that referenced 029 * element has no such definition. Thus, if a referenced element has no 030 * defined 'sboTerm' attribute or child Notes or Annotation objects, that 031 * element should be considered to now have the 'sboTerm', child Notes, or 032 * child Annotation of the {@link ListOfMembers}. 033 <p> 034 * If multiple {@link ListOfMembers} have child {@link Member} elements that reference 035 * the same SBML element, and more than one {@link ListOfMembers} or {@link Member} has 036 * a value for an sboTerm attribute, Notes, or Annotation element, those 037 * {@link Member} elements should be consistent with each other: the 'sboTerm' 038 * attributes should either be identical, or one should inherit from 039 * the other; Notes should say the same or similar things; and Annotation 040 * elements should not conflict. Interpreters may choose to resolve any 041 * such conflicts arbitrarily. 042 <p> 043 * An uncommon feature about {@link ListOfMembers} is that, if it is referenced by a 044 * {@link Member} of a different {@link Group}, the <em>children</em> of the referenced 045 * {@link ListOfMembers} are also considered to be members of the referencing group. 046 * In this way, groups may be nested semantically to create larger groups out 047 * of subgroups. 048 <p> 049 * <h2>Semantics of group memberships</h2> 050 <p> 051 * <p> 052 * If a {@link Member} object within a {@link Group} object's {@link ListOfMembers} references 053 * another {@link Group} object, it is the <em>referenced {@link Group} itself</em> that is 054 * considered to be a member of the parent {@link Group}, <em>not</em> the corresponding 055 * referenced model component(s). This is true regardless of whether those 056 * components themselves happen to point to other components using some 057 * mechanism defined by another SBML Level 3 package (as happens, for 058 * example, in the SBML Level 3 Hierarchical Model Composition package 059 * and its use of {@link SBaseRef}). However, if instead a {@link Member} object references 060 * a {@link ListOfMembers} object (using the 'id' attribute permitted on 061 * {@link ListOfMembers} objects), it is the components of that {@link ListOfMembers} that 062 * are considered to be part of the parent {@link Group}. In other words: if in some 063 * {@link Group} <em>G</em>, a {@link Member} <em>M</em> references another {@link Group}, that {@link Group} is the 064 * member of <em>G</em>; if <em>M</em> references a {@link ListOfMembers}, it is the entities 065 * referenced by the {@link Member} objects within the {@link ListOfMembers} that are 066 * the members of <em>G</em> and not the {@link ListOfMembers} object itself. 067 <p> 068 * The implication of this is that any rule that applies to members of a 069 * group (such the meaning of the 'kind' attribute, or the restrictions on 070 * the application of 'sboTerm' attributes on a {@link ListOfMembers}) applies to the 071 * child group when referenced by the {@link Group} 'id', and to the members of the 072 * child group when referenced by the {@link ListOfMembers} 'id'. In an example 073 * situation where a parent group includes two {@link Species} plus a {@link Group} which 074 * itself contains three other {@link Species}, if the parent group's {@link ListOfMembers} 075 * is given an 'sboTerm' attribute value, that {@link SBO} term applies to the two 076 * species and the group, not to the three child species members of the 077 * second group. (Note also that in such a case, the parent group's 'kind' 078 * attribute value would almost certainly be <code>'collection'</code> or 079 * <code>'partonomy'</code>, and not <code>'classification'</code>, as two species and a group are 080 * very unlikely to be classified as the same thing.) In contrast, in the 081 * situation where a parent group includes two {@link Species} plus a {@link ListOfMembers} 082 * which contains three other {@link Species}, the parent group's {@link ListOfMembers} 083 * 'sboTerm' would apply to the five {@link Species}, and could be more reasonably 084 * marked as a <code>'classification'.</code> 085 <p> 086 * In a future version of this SBML Level 3 Groups specification, it may 087 * be possible to perform set operations on groups, but for now, this type of 088 * union is the only set operation that is possible. 089 <p> 090 * Groups are not permitted to be circular: no {@link Member} may reference itself, 091 * its parent {@link ListOfMembers}, nor its parent {@link Group}. If a {@link Member} references a 092 * {@link Group}, the same restrictions apply to that subgroup's children: they may 093 * not reference the {@link Member}, its parent {@link ListOfMembers}, nor its parent {@link Group}, 094 * and if any of those children reference a {@link Group}, the same restrictions apply 095 * to them, etc. 096 <p> 097 * If a {@link Member} has a 'idRef' or 'metaIdRef' attribute which references an 098 * object from a namespace that is not understood by the interpreter of the 099 * SBML model, that {@link Member} must be ignored. The referenced object will not be 100 * understood by the interpreter, and therefore has no need to become a 101 * member of the group. If an interpreter cannot tell whether a referenced 102 * object does not exist or if exists in an unparsed namespace, it may choose 103 * to produce a warning. 104 <p> 105 * @see Group 106 * @see Member 107 * @see ListOfGroups 108 */ 109 110public class ListOfMembers extends ListOf { 111 private long swigCPtr; 112 113 protected ListOfMembers(long cPtr, boolean cMemoryOwn) 114 { 115 super(libsbmlJNI.ListOfMembers_SWIGUpcast(cPtr), cMemoryOwn); 116 swigCPtr = cPtr; 117 } 118 119 protected static long getCPtr(ListOfMembers obj) 120 { 121 return (obj == null) ? 0 : obj.swigCPtr; 122 } 123 124 protected static long getCPtrAndDisown (ListOfMembers obj) 125 { 126 long ptr = 0; 127 128 if (obj != null) 129 { 130 ptr = obj.swigCPtr; 131 obj.swigCMemOwn = false; 132 } 133 134 return ptr; 135 } 136 137 protected void finalize() { 138 delete(); 139 } 140 141 public synchronized void delete() { 142 if (swigCPtr != 0) { 143 if (swigCMemOwn) { 144 swigCMemOwn = false; 145 libsbmlJNI.delete_ListOfMembers(swigCPtr); 146 } 147 swigCPtr = 0; 148 } 149 super.delete(); 150 } 151 152 153/** 154 * Creates a new {@link ListOfMembers} using the given SBML Level, Version and 155 * “groups” package version. 156 <p> 157 * @param level a long integer, the SBML Level to assign to this 158 * {@link ListOfMembers}. 159 <p> 160 * @param version a long integer, the SBML Version to assign to this 161 * {@link ListOfMembers}. 162 <p> 163 * @param pkgVersion a long integer, the SBML Groups Version to assign to 164 * this {@link ListOfMembers}. 165 <p> 166 * <p> 167 * @note Attempting to add an object to an {@link SBMLDocument} having a different 168 * combination of SBML Level, Version and XML namespaces than the object 169 * itself will result in an error at the time a caller attempts to make the 170 * addition. A parent object must have compatible Level, Version and XML 171 * namespaces. (Strictly speaking, a parent may also have more XML 172 * namespaces than a child, but the reverse is not permitted.) The 173 * restriction is necessary to ensure that an SBML model has a consistent 174 * overall structure. This requires callers to manage their objects 175 * carefully, but the benefit is increased flexibility in how models can be 176 * created by permitting callers to create objects bottom-up if desired. In 177 * situations where objects are not yet attached to parents (e.g., 178 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 179 * libSBML determine such things as whether it is valid to assign a 180 * particular value to an attribute. For packages, this means that the 181 * parent object to which this package element is being added must have 182 * been created with the package namespace, or that the package namespace 183 * was added to it, even if that parent is not a package object itself. 184 */ public 185 ListOfMembers(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 186 this(libsbmlJNI.new_ListOfMembers__SWIG_0(level, version, pkgVersion), true); 187 } 188 189 190/** 191 * Creates a new {@link ListOfMembers} using the given SBML Level, Version and 192 * “groups” package version. 193 <p> 194 * @param level a long integer, the SBML Level to assign to this 195 * {@link ListOfMembers}. 196 <p> 197 * @param version a long integer, the SBML Version to assign to this 198 * {@link ListOfMembers}. 199 <p> 200 * @param pkgVersion a long integer, the SBML Groups Version to assign to 201 * this {@link ListOfMembers}. 202 <p> 203 * <p> 204 * @note Attempting to add an object to an {@link SBMLDocument} having a different 205 * combination of SBML Level, Version and XML namespaces than the object 206 * itself will result in an error at the time a caller attempts to make the 207 * addition. A parent object must have compatible Level, Version and XML 208 * namespaces. (Strictly speaking, a parent may also have more XML 209 * namespaces than a child, but the reverse is not permitted.) The 210 * restriction is necessary to ensure that an SBML model has a consistent 211 * overall structure. This requires callers to manage their objects 212 * carefully, but the benefit is increased flexibility in how models can be 213 * created by permitting callers to create objects bottom-up if desired. In 214 * situations where objects are not yet attached to parents (e.g., 215 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 216 * libSBML determine such things as whether it is valid to assign a 217 * particular value to an attribute. For packages, this means that the 218 * parent object to which this package element is being added must have 219 * been created with the package namespace, or that the package namespace 220 * was added to it, even if that parent is not a package object itself. 221 */ public 222 ListOfMembers(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 223 this(libsbmlJNI.new_ListOfMembers__SWIG_1(level, version), true); 224 } 225 226 227/** 228 * Creates a new {@link ListOfMembers} using the given SBML Level, Version and 229 * “groups” package version. 230 <p> 231 * @param level a long integer, the SBML Level to assign to this 232 * {@link ListOfMembers}. 233 <p> 234 * @param version a long integer, the SBML Version to assign to this 235 * {@link ListOfMembers}. 236 <p> 237 * @param pkgVersion a long integer, the SBML Groups Version to assign to 238 * this {@link ListOfMembers}. 239 <p> 240 * <p> 241 * @note Attempting to add an object to an {@link SBMLDocument} having a different 242 * combination of SBML Level, Version and XML namespaces than the object 243 * itself will result in an error at the time a caller attempts to make the 244 * addition. A parent object must have compatible Level, Version and XML 245 * namespaces. (Strictly speaking, a parent may also have more XML 246 * namespaces than a child, but the reverse is not permitted.) The 247 * restriction is necessary to ensure that an SBML model has a consistent 248 * overall structure. This requires callers to manage their objects 249 * carefully, but the benefit is increased flexibility in how models can be 250 * created by permitting callers to create objects bottom-up if desired. In 251 * situations where objects are not yet attached to parents (e.g., 252 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 253 * libSBML determine such things as whether it is valid to assign a 254 * particular value to an attribute. For packages, this means that the 255 * parent object to which this package element is being added must have 256 * been created with the package namespace, or that the package namespace 257 * was added to it, even if that parent is not a package object itself. 258 */ public 259 ListOfMembers(long level) throws org.sbml.libsbml.SBMLConstructorException { 260 this(libsbmlJNI.new_ListOfMembers__SWIG_2(level), true); 261 } 262 263 264/** 265 * Creates a new {@link ListOfMembers} using the given SBML Level, Version and 266 * “groups” package version. 267 <p> 268 * @param level a long integer, the SBML Level to assign to this 269 * {@link ListOfMembers}. 270 <p> 271 * @param version a long integer, the SBML Version to assign to this 272 * {@link ListOfMembers}. 273 <p> 274 * @param pkgVersion a long integer, the SBML Groups Version to assign to 275 * this {@link ListOfMembers}. 276 <p> 277 * <p> 278 * @note Attempting to add an object to an {@link SBMLDocument} having a different 279 * combination of SBML Level, Version and XML namespaces than the object 280 * itself will result in an error at the time a caller attempts to make the 281 * addition. A parent object must have compatible Level, Version and XML 282 * namespaces. (Strictly speaking, a parent may also have more XML 283 * namespaces than a child, but the reverse is not permitted.) The 284 * restriction is necessary to ensure that an SBML model has a consistent 285 * overall structure. This requires callers to manage their objects 286 * carefully, but the benefit is increased flexibility in how models can be 287 * created by permitting callers to create objects bottom-up if desired. In 288 * situations where objects are not yet attached to parents (e.g., 289 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 290 * libSBML determine such things as whether it is valid to assign a 291 * particular value to an attribute. For packages, this means that the 292 * parent object to which this package element is being added must have 293 * been created with the package namespace, or that the package namespace 294 * was added to it, even if that parent is not a package object itself. 295 */ public 296 ListOfMembers() throws org.sbml.libsbml.SBMLConstructorException { 297 this(libsbmlJNI.new_ListOfMembers__SWIG_3(), true); 298 } 299 300 301/** 302 * Creates a new {@link ListOfMembers} using the given {@link GroupsPkgNamespaces} object. 303 <p> 304 * <p> 305 * The package namespaces object used in this constructor is derived from a 306 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 307 * information. It is used to communicate the SBML Level, Version, and 308 * package version and name information used in addition to SBML Level 3 Core. A 309 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 310 * package namespace object somewhere in a program once, then hand that object 311 * as needed to object constructors of that package that accept it as and 312 * argument, such as this one. 313 <p> 314 * @param groupsns the {@link GroupsPkgNamespaces} object. 315 <p> 316 * <p> 317 * @note Attempting to add an object to an {@link SBMLDocument} having a different 318 * combination of SBML Level, Version and XML namespaces than the object 319 * itself will result in an error at the time a caller attempts to make the 320 * addition. A parent object must have compatible Level, Version and XML 321 * namespaces. (Strictly speaking, a parent may also have more XML 322 * namespaces than a child, but the reverse is not permitted.) The 323 * restriction is necessary to ensure that an SBML model has a consistent 324 * overall structure. This requires callers to manage their objects 325 * carefully, but the benefit is increased flexibility in how models can be 326 * created by permitting callers to create objects bottom-up if desired. In 327 * situations where objects are not yet attached to parents (e.g., 328 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 329 * libSBML determine such things as whether it is valid to assign a 330 * particular value to an attribute. For packages, this means that the 331 * parent object to which this package element is being added must have 332 * been created with the package namespace, or that the package namespace 333 * was added to it, even if that parent is not a package object itself. 334 */ public 335 ListOfMembers(GroupsPkgNamespaces groupsns) throws org.sbml.libsbml.SBMLConstructorException { 336 this(libsbmlJNI.new_ListOfMembers__SWIG_4(GroupsPkgNamespaces.getCPtr(groupsns), groupsns), true); 337 } 338 339 340/** 341 * Copy constructor for {@link ListOfMembers}. 342 <p> 343 * @param orig the {@link ListOfMembers} instance to copy. 344 */ public 345 ListOfMembers(ListOfMembers orig) throws org.sbml.libsbml.SBMLConstructorException { 346 this(libsbmlJNI.new_ListOfMembers__SWIG_5(ListOfMembers.getCPtr(orig), orig), true); 347 } 348 349 350/** 351 * Creates and returns a deep copy of this {@link ListOfMembers} object. 352 <p> 353 * @return a (deep) copy of this {@link ListOfMembers} object. 354 */ public 355 ListOfMembers cloneObject() { 356 long cPtr = libsbmlJNI.ListOfMembers_cloneObject(swigCPtr, this); 357 return (cPtr == 0) ? null : new ListOfMembers(cPtr, true); 358 } 359 360 361/** 362 * Returns the value of the 'id' attribute of this {@link ListOfMembers}. 363 <p> 364 * @return the value of the 'id' attribute of this {@link ListOfMembers} as a string. 365 */ public 366 String getId() { 367 return libsbmlJNI.ListOfMembers_getId(swigCPtr, this); 368 } 369 370 371/** 372 * Returns the value of the 'name' attribute of this {@link ListOfMembers}. 373 <p> 374 * @return the value of the 'name' attribute of this {@link ListOfMembers} as a 375 * string. 376 */ public 377 String getName() { 378 return libsbmlJNI.ListOfMembers_getName(swigCPtr, this); 379 } 380 381 382/** 383 * Predicate returning <code>true</code> if this {@link ListOfMembers}'s 'id' attribute is set. 384 <p> 385 * @return <code>true</code> if this {@link ListOfMembers}'s 'id' attribute has been set, 386 * otherwise <code>false</code> is returned. 387 */ public 388 boolean isSetId() { 389 return libsbmlJNI.ListOfMembers_isSetId(swigCPtr, this); 390 } 391 392 393/** 394 * Predicate returning <code>true</code> if this {@link ListOfMembers}'s 'name' attribute is 395 * set. 396 <p> 397 * @return <code>true</code> if this {@link ListOfMembers}'s 'name' attribute has been set, 398 * otherwise <code>false</code> is returned. 399 */ public 400 boolean isSetName() { 401 return libsbmlJNI.ListOfMembers_isSetName(swigCPtr, this); 402 } 403 404 405/** 406 * Sets the value of the 'id' attribute of this {@link ListOfMembers}. 407 <p> 408 * @param id String& value of the 'id' attribute to be set. 409 <p> 410 * <p> 411 * @return integer value indicating success/failure of the 412 * function. The possible values 413 * returned by this function are: 414 * <ul> 415 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 416 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 417 * 418 * </ul> <p> 419 * Calling this function with <code>id</code> = <code>null</code> or an empty string is 420 * equivalent to calling unsetId(). 421 */ public 422 int setId(String id) { 423 return libsbmlJNI.ListOfMembers_setId(swigCPtr, this, id); 424 } 425 426 427/** 428 * Sets the value of the 'name' attribute of this {@link ListOfMembers}. 429 <p> 430 * @param name String& value of the 'name' attribute to be set. 431 <p> 432 * <p> 433 * @return integer value indicating success/failure of the 434 * function. This particular 435 * function only does one thing irrespective of user input or 436 * object state, and thus will only return a single value: 437 * <ul> 438 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 439 * 440 * </ul> <p> 441 * Calling this function with <code>name</code> = <code>null</code> or an empty string is 442 * equivalent to calling unsetName(). 443 */ public 444 int setName(String name) { 445 return libsbmlJNI.ListOfMembers_setName(swigCPtr, this, name); 446 } 447 448 449/** 450 * Unsets the value of the 'id' attribute of this {@link ListOfMembers}. 451 <p> 452 * <p> 453 * @return integer value indicating success/failure of the 454 * function. The possible values 455 * returned by this function are: 456 * <ul> 457 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 458 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 459 * </ul> 460 */ public 461 int unsetId() { 462 return libsbmlJNI.ListOfMembers_unsetId(swigCPtr, this); 463 } 464 465 466/** 467 * Unsets the value of the 'name' attribute of this {@link ListOfMembers}. 468 <p> 469 * <p> 470 * @return integer value indicating success/failure of the 471 * function. The possible values 472 * returned by this function are: 473 * <ul> 474 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 475 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 476 * </ul> 477 */ public 478 int unsetName() { 479 return libsbmlJNI.ListOfMembers_unsetName(swigCPtr, this); 480 } 481 482 483/** 484 * Get a {@link Member} from the {@link ListOfMembers}. 485 <p> 486 * @param n a long integer representing the index of the {@link Member} to retrieve. 487 <p> 488 * @return the nth {@link Member} in this {@link ListOfMembers}. 489 <p> 490 * <p> 491 * The pointer that is returned by this function is not owned by the caller, 492 * but may be queried and modified. Any changes made will be reflected in any 493 * resulting SBML document containing the pointer's parent. 494 <p> 495 * @see #addMember(Member object) 496 * @see #createMember() 497 * @see #get(String sid) 498 * @see #getNumMembers() 499 * @see #remove(String sid) 500 * @see #remove(long n) 501 */ public 502 Member get(long n) { 503 long cPtr = libsbmlJNI.ListOfMembers_get__SWIG_0(swigCPtr, this, n); 504 return (cPtr == 0) ? null : new Member(cPtr, false); 505 } 506 507 508/** 509 * Get a {@link Member} from the {@link ListOfMembers} based on its identifier. 510 <p> 511 * @param sid a string representing the identifier of the {@link Member} to retrieve. 512 <p> 513 * @return the {@link Member} in this {@link ListOfMembers} with the given <code>sid</code> or <code>null</code> 514 * if no such {@link Member} exists. 515 <p> 516 * <p> 517 * The pointer that is returned by this function is not owned by the caller, 518 * but may be queried and modified. Any changes made will be reflected in any 519 * resulting SBML document containing the pointer's parent. 520 <p> 521 * @see #addMember(Member object) 522 * @see #createMember() 523 * @see #get(long n) 524 * @see #getNumMembers() 525 * @see #remove(String sid) 526 * @see #remove(long n) 527 */ public 528 Member get(String sid) { 529 long cPtr = libsbmlJNI.ListOfMembers_get__SWIG_2(swigCPtr, this, sid); 530 return (cPtr == 0) ? null : new Member(cPtr, false); 531 } 532 533 534/** 535 * Removes the nth {@link Member} from this {@link ListOfMembers} and returns a pointer to 536 * it. 537 <p> 538 * @param n a long integer representing the index of the {@link Member} to remove. 539 <p> 540 * @return a pointer to the nth {@link Member} in this {@link ListOfMembers}. 541 <p> 542 * <p> 543 * The pointer that is returned by this function is owned by the caller, 544 * who is responsible for deleting it. Any changes made to the element 545 * will not be reflected in any resulting SBML document unless the element 546 * is added to an SBML Document. Even in this case, the element's deletion is 547 * still the responsibility of the caller with two exceptions: if it is used 548 * as the 'disownedItem' in the * {@link ListOf#appendAndOwn()} or {@link ListOf#insertAndOwn()} 549 * functions. All other functions in libsbml add a copy of the element, 550 * and do not transfer ownership of the pointer. 551 <p> 552 * @see #addMember(Member object) 553 * @see #createMember() 554 * @see #get(String sid) 555 * @see #get(long n) 556 * @see #getNumMembers() 557 * @see #remove(String sid) 558 */ public 559 Member remove(long n) { 560 long cPtr = libsbmlJNI.ListOfMembers_remove__SWIG_0(swigCPtr, this, n); 561 return (cPtr == 0) ? null : new Member(cPtr, true); 562 } 563 564 565/** 566 * Removes the {@link Member} from this {@link ListOfMembers} based on its identifier and 567 * returns a pointer to it. 568 <p> 569 * @param sid a string representing the identifier of the {@link Member} to remove. 570 <p> 571 * @return the {@link Member} in this {@link ListOfMembers} based on the identifier or null 572 * if no such {@link Member} exists. 573 <p> 574 * <p> 575 * The pointer that is returned by this function is owned by the caller, 576 * who is responsible for deleting it. Any changes made to the element 577 * will not be reflected in any resulting SBML document unless the element 578 * is added to an SBML Document. Even in this case, the element's deletion is 579 * still the responsibility of the caller with two exceptions: if it is used 580 * as the 'disownedItem' in the * {@link ListOf#appendAndOwn()} or {@link ListOf#insertAndOwn()} 581 * functions. All other functions in libsbml add a copy of the element, 582 * and do not transfer ownership of the pointer. 583 <p> 584 * @see #addMember(Member object) 585 * @see #createMember() 586 * @see #get(String sid) 587 * @see #get(long n) 588 * @see #getNumMembers() 589 * @see #remove(long n) 590 */ public 591 Member remove(String sid) { 592 long cPtr = libsbmlJNI.ListOfMembers_remove__SWIG_1(swigCPtr, this, sid); 593 return (cPtr == 0) ? null : new Member(cPtr, true); 594 } 595 596 597/** 598 * Adds a copy of the given {@link Member} to this {@link ListOfMembers}. 599 <p> 600 * @param m the {@link Member} object to add. 601 <p> 602 * <p> 603 * @return integer value indicating success/failure of the 604 * function. The possible values 605 * returned by this function are: 606 * <ul> 607 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 608 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 609 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 610 * <li> {@link libsbmlConstants#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH} 611 * <li> {@link libsbmlConstants#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH} 612 * <li> {@link libsbmlConstants#LIBSBML_PKG_VERSION_MISMATCH LIBSBML_PKG_VERSION_MISMATCH} 613 * <li> {@link libsbmlConstants#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID} 614 * 615 * </ul> <p> 616 * <p> 617 * @note This method should be used with some caution. The fact that this 618 * method <em>copies</em> the object passed to it means that the caller will be 619 * left holding a physically different object instance than the one contained 620 * inside this object. Changes made to the original object instance (such as 621 * resetting attribute values) will <em>not affect the instance in this 622 * object</em>. In addition, the caller should make sure to free the 623 * original object if it is no longer being used, or else a memory leak will 624 * result. Please see other methods on this class (particularly a 625 * corresponding method whose name begins with the word <code>create</code>) 626 * for alternatives that do not lead to these issues. 627 <p> 628 * @see #createMember() 629 * @see #get(String sid) 630 * @see #get(long n) 631 * @see #getNumMembers() 632 * @see #remove(String sid) 633 * @see #remove(long n) 634 */ public 635 int addMember(Member m) { 636 return libsbmlJNI.ListOfMembers_addMember(swigCPtr, this, Member.getCPtr(m), m); 637 } 638 639 640/** 641 * Get the number of {@link Member} objects in this {@link ListOfMembers}. 642 <p> 643 * @return the number of {@link Member} objects in this {@link ListOfMembers}. 644 <p> 645 * @see #addMember(Member object) 646 * @see #createMember() 647 * @see #get(String sid) 648 * @see #get(long n) 649 * @see #remove(String sid) 650 * @see #remove(long n) 651 */ public 652 long getNumMembers() { 653 return libsbmlJNI.ListOfMembers_getNumMembers(swigCPtr, this); 654 } 655 656 657/** 658 * Creates a new {@link Member} object, adds it to this {@link ListOfMembers} object and 659 * returns the {@link Member} object created. 660 <p> 661 * @return a new {@link Member} object instance. 662 <p> 663 * <p> 664 * The pointer that is returned by this function is not owned by the caller, 665 * but may be queried and modified. Any changes made will be reflected in any 666 * resulting SBML document containing the pointer's parent. 667 <p> 668 * @see #addMember(Member object) 669 * @see #get(String sid) 670 * @see #get(long n) 671 * @see #getNumMembers() 672 * @see #remove(String sid) 673 * @see #remove(long n) 674 */ public 675 Member createMember() { 676 long cPtr = libsbmlJNI.ListOfMembers_createMember(swigCPtr, this); 677 return (cPtr == 0) ? null : new Member(cPtr, false); 678 } 679 680 681/** 682 * Get a {@link Member} from the {@link ListOfMembers} based on the element to which it 683 * refers. 684 <p> 685 * @param sid a string representing the 'idRef' attribute of the {@link Member} 686 * object to retrieve. 687 <p> 688 * @return the first {@link Member} in this {@link ListOfMembers} based on the given idRef 689 * attribute or null if no such {@link Member} exists. 690 <p> 691 * <p> 692 * The pointer that is returned by this function is not owned by the caller, 693 * but may be queried and modified. Any changes made will be reflected in any 694 * resulting SBML document containing the pointer's parent. 695 */ public 696 Member getByIdRef(String sid) { 697 long cPtr = libsbmlJNI.ListOfMembers_getByIdRef__SWIG_0(swigCPtr, this, sid); 698 return (cPtr == 0) ? null : new Member(cPtr, false); 699 } 700 701 702/** 703 * Returns the XML element name of this {@link ListOfMembers} object. 704 <p> 705 * For {@link ListOfMembers}, the XML element name is always <code>'listOfMembers'.</code> 706 <p> 707 * @return the name of this element, i.e. <code>'listOfMembers'.</code> 708 */ public 709 String getElementName() { 710 return libsbmlJNI.ListOfMembers_getElementName(swigCPtr, this); 711 } 712 713 714/** 715 * Returns the libSBML type code for this {@link ListOfMembers} object. 716 <p> 717 * <p> 718 * LibSBML attaches an identifying code to every kind of SBML object. These 719 * are integer constants known as <em>SBML type codes</em>. The names of all 720 * the codes begin with the characters <code>SBML_</code>. 721 * In the Java language interface for libSBML, the 722 * type codes are defined as static integer constants in the interface class 723 * {@link libsbmlConstants}. Note that different Level 3 724 * package plug-ins may use overlapping type codes; to identify the package 725 * to which a given object belongs, call the 726 * <code>{@link SBase#getPackageName()} 727 * </code> 728 * method on the object. 729 <p> 730 * @return the SBML type code for this object: 731 * {@link libsbmlConstants#SBML_LIST_OF SBML_LIST_OF} 732 <p> 733 * <p> 734 * @warning <span class='warning'>The specific integer values of the possible 735 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 736 * packages, To fully identify the correct code, <strong>it is necessary to 737 * invoke both getTypeCode() and getPackageName()</strong>.</span> 738 */ public 739 int getTypeCode() { 740 return libsbmlJNI.ListOfMembers_getTypeCode(swigCPtr, this); 741 } 742 743 744/** 745 * Returns the libSBML type code for the SBML objects contained in this 746 * {@link ListOfMembers} object. 747 <p> 748 * <p> 749 * LibSBML attaches an identifying code to every kind of SBML object. These 750 * are integer constants known as <em>SBML type codes</em>. The names of all 751 * the codes begin with the characters <code>SBML_</code>. 752 * In the Java language interface for libSBML, the 753 * type codes are defined as static integer constants in the interface class 754 * {@link libsbmlConstants}. Note that different Level 3 755 * package plug-ins may use overlapping type codes; to identify the package 756 * to which a given object belongs, call the 757 * <code>{@link SBase#getPackageName()} 758 * </code> 759 * method on the object. 760 <p> 761 * @return the SBML typecode for the objects contained in this ListOfMembers: 762 * {@link libsbmlConstants#SBML_GROUPS_MEMBER SBML_GROUPS_MEMBER} 763 <p> 764 * <p> 765 * @warning <span class='warning'>The specific integer values of the possible 766 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 767 * packages, To fully identify the correct code, <strong>it is necessary to 768 * invoke both getTypeCode() and getPackageName()</strong>.</span> 769 <p> 770 * @see #getElementName() 771 * @see #getPackageName() 772 */ public 773 int getItemTypeCode() { 774 return libsbmlJNI.ListOfMembers_getItemTypeCode(swigCPtr, this); 775 } 776 777 778/** 779 * Predicate returning <code>true</code> if all the required attributes for this 780 * {@link ListOfMembers} object have been set. 781 <p> 782 * @return <code>true</code> to indicate that all the required attributes of this 783 * {@link ListOfMembers} have been set, otherwise <code>false</code> is returned. 784 */ public 785 boolean hasRequiredAttributes() { 786 return libsbmlJNI.ListOfMembers_hasRequiredAttributes(swigCPtr, this); 787 } 788 789}