001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.10 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-comp"><a href="group__comp.html">comp</a></span> 013 A list of {@link Deletion} objects. 014 <p> 015 * The {@link ListOfDeletions} is a container for the “comp” 016 * {@link Submodel} that defines elements to be removed before instantiation. 017 <p> 018 * <p> 019 * The various ListOf___ classes in SBML 020 * are merely containers used for organizing the main components of an SBML 021 * model. In libSBML's implementation, ListOf___ 022 * classes are derived from the 023 * intermediate utility class {@link ListOf}, which 024 * is not defined by the SBML specifications but serves as a useful 025 * programmatic construct. {@link ListOf} is itself is in turn derived from {@link SBase}, 026 * which provides all of the various ListOf___ 027 * classes with common features 028 * defined by the SBML specification, such as 'metaid' attributes and 029 * annotations. 030 <p> 031 * The relationship between the lists and the rest of an SBML model is 032 * illustrated by the following (for SBML Level 2 Version 4): 033 <p> 034 * <figure> 035 <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object> 036</figure> 037 038 <p> 039 * SBML Level 3 Version 1 has essentially the same structure as 040 * Level 2 Version 4, depicted above, but SBML Level 3 041 * Version 2 allows 042 * containers to contain zero or more of the relevant object, instead of 043 * requiring at least one. As such, libsbml will write out an 044 * otherwise-empty ListOf___ element that has any optional attribute set 045 * (such as 'id' or 'metaid'), that has an optional child (such 046 * as a 'notes' or 'annotation'), or that has attributes or children set 047 * from any SBML Level 3 package, whether or not the ListOf___ has 048 * any other children. 049 <p> 050 * Readers may wonder about the motivations for using the ListOf___ 051 * containers in SBML. A simpler approach in XML might be to place the 052 * components all directly at the top level of the model definition. The 053 * choice made in SBML is to group them within XML elements named after 054 * ListOf<em>Classname</em>, in part because it helps organize the 055 * components. More importantly, the fact that the container classes are 056 * derived from {@link SBase} means that software tools can add information <em>about</em> 057 * the lists themselves into each list container's 'annotation'. 058 <p> 059 * @see ListOfFunctionDefinitions 060 * @see ListOfUnitDefinitions 061 * @see ListOfCompartmentTypes 062 * @see ListOfSpeciesTypes 063 * @see ListOfCompartments 064 * @see ListOfSpecies 065 * @see ListOfParameters 066 * @see ListOfInitialAssignments 067 * @see ListOfRules 068 * @see ListOfConstraints 069 * @see ListOfReactions 070 * @see ListOfEvents 071 <p> 072 * @see Deletion 073 * @see ListOfExternalModelDefinitions 074 * @see ListOfModelDefinitions 075 * @see ListOfPorts 076 * @see ListOfReplacedElements 077 * @see ListOfSubmodels 078 */ 079 080public class ListOfDeletions extends ListOf { 081 private long swigCPtr; 082 083 protected ListOfDeletions(long cPtr, boolean cMemoryOwn) 084 { 085 super(libsbmlJNI.ListOfDeletions_SWIGUpcast(cPtr), cMemoryOwn); 086 swigCPtr = cPtr; 087 } 088 089 protected static long getCPtr(ListOfDeletions obj) 090 { 091 return (obj == null) ? 0 : obj.swigCPtr; 092 } 093 094 protected static long getCPtrAndDisown (ListOfDeletions obj) 095 { 096 long ptr = 0; 097 098 if (obj != null) 099 { 100 ptr = obj.swigCPtr; 101 obj.swigCMemOwn = false; 102 } 103 104 return ptr; 105 } 106 107 protected void finalize() { 108 delete(); 109 } 110 111 public synchronized void delete() { 112 if (swigCPtr != 0) { 113 if (swigCMemOwn) { 114 swigCMemOwn = false; 115 libsbmlJNI.delete_ListOfDeletions(swigCPtr); 116 } 117 swigCPtr = 0; 118 } 119 super.delete(); 120 } 121 122 123/** 124 * Creates and returns a deep copy of this {@link ListOfDeletions} object. 125 <p> 126 * @return a (deep) copy of this {@link ListOfDeletions}. 127 */ public 128 ListOfDeletions cloneObject() { 129 long cPtr = libsbmlJNI.ListOfDeletions_cloneObject(swigCPtr, this); 130 return (cPtr == 0) ? null : new ListOfDeletions(cPtr, true); 131 } 132 133 134/** 135 * Creates a new {@link ListOfDeletions} with the given level, version, and package 136 * version. 137 <p> 138 * @param level the SBML Level. 139 * @param version the Version within the SBML Level. 140 * @param pkgVersion the version of the package. 141 <p> 142 * <p> 143 * @note Attempting to add an object to an {@link SBMLDocument} having a different 144 * combination of SBML Level, Version and XML namespaces than the object 145 * itself will result in an error at the time a caller attempts to make the 146 * addition. A parent object must have compatible Level, Version and XML 147 * namespaces. (Strictly speaking, a parent may also have more XML 148 * namespaces than a child, but the reverse is not permitted.) The 149 * restriction is necessary to ensure that an SBML model has a consistent 150 * overall structure. This requires callers to manage their objects 151 * carefully, but the benefit is increased flexibility in how models can be 152 * created by permitting callers to create objects bottom-up if desired. In 153 * situations where objects are not yet attached to parents (e.g., 154 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 155 * libSBML determine such things as whether it is valid to assign a 156 * particular value to an attribute. For packages, this means that the 157 * parent object to which this package element is being added must have 158 * been created with the package namespace, or that the package namespace 159 * was added to it, even if that parent is not a package object itself. 160 */ public 161 ListOfDeletions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 162 this(libsbmlJNI.new_ListOfDeletions__SWIG_0(level, version, pkgVersion), true); 163 } 164 165 166/** 167 * Creates a new {@link ListOfDeletions} with the given level, version, and package 168 * version. 169 <p> 170 * @param level the SBML Level. 171 * @param version the Version within the SBML Level. 172 * @param pkgVersion the version of the package. 173 <p> 174 * <p> 175 * @note Attempting to add an object to an {@link SBMLDocument} having a different 176 * combination of SBML Level, Version and XML namespaces than the object 177 * itself will result in an error at the time a caller attempts to make the 178 * addition. A parent object must have compatible Level, Version and XML 179 * namespaces. (Strictly speaking, a parent may also have more XML 180 * namespaces than a child, but the reverse is not permitted.) The 181 * restriction is necessary to ensure that an SBML model has a consistent 182 * overall structure. This requires callers to manage their objects 183 * carefully, but the benefit is increased flexibility in how models can be 184 * created by permitting callers to create objects bottom-up if desired. In 185 * situations where objects are not yet attached to parents (e.g., 186 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 187 * libSBML determine such things as whether it is valid to assign a 188 * particular value to an attribute. For packages, this means that the 189 * parent object to which this package element is being added must have 190 * been created with the package namespace, or that the package namespace 191 * was added to it, even if that parent is not a package object itself. 192 */ public 193 ListOfDeletions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 194 this(libsbmlJNI.new_ListOfDeletions__SWIG_1(level, version), true); 195 } 196 197 198/** 199 * Creates a new {@link ListOfDeletions} with the given level, version, and package 200 * version. 201 <p> 202 * @param level the SBML Level. 203 * @param version the Version within the SBML Level. 204 * @param pkgVersion the version of the package. 205 <p> 206 * <p> 207 * @note Attempting to add an object to an {@link SBMLDocument} having a different 208 * combination of SBML Level, Version and XML namespaces than the object 209 * itself will result in an error at the time a caller attempts to make the 210 * addition. A parent object must have compatible Level, Version and XML 211 * namespaces. (Strictly speaking, a parent may also have more XML 212 * namespaces than a child, but the reverse is not permitted.) The 213 * restriction is necessary to ensure that an SBML model has a consistent 214 * overall structure. This requires callers to manage their objects 215 * carefully, but the benefit is increased flexibility in how models can be 216 * created by permitting callers to create objects bottom-up if desired. In 217 * situations where objects are not yet attached to parents (e.g., 218 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 219 * libSBML determine such things as whether it is valid to assign a 220 * particular value to an attribute. For packages, this means that the 221 * parent object to which this package element is being added must have 222 * been created with the package namespace, or that the package namespace 223 * was added to it, even if that parent is not a package object itself. 224 */ public 225 ListOfDeletions(long level) throws org.sbml.libsbml.SBMLConstructorException { 226 this(libsbmlJNI.new_ListOfDeletions__SWIG_2(level), true); 227 } 228 229 230/** 231 * Creates a new {@link ListOfDeletions} with the given level, version, and package 232 * version. 233 <p> 234 * @param level the SBML Level. 235 * @param version the Version within the SBML Level. 236 * @param pkgVersion the version of the package. 237 <p> 238 * <p> 239 * @note Attempting to add an object to an {@link SBMLDocument} having a different 240 * combination of SBML Level, Version and XML namespaces than the object 241 * itself will result in an error at the time a caller attempts to make the 242 * addition. A parent object must have compatible Level, Version and XML 243 * namespaces. (Strictly speaking, a parent may also have more XML 244 * namespaces than a child, but the reverse is not permitted.) The 245 * restriction is necessary to ensure that an SBML model has a consistent 246 * overall structure. This requires callers to manage their objects 247 * carefully, but the benefit is increased flexibility in how models can be 248 * created by permitting callers to create objects bottom-up if desired. In 249 * situations where objects are not yet attached to parents (e.g., 250 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 251 * libSBML determine such things as whether it is valid to assign a 252 * particular value to an attribute. For packages, this means that the 253 * parent object to which this package element is being added must have 254 * been created with the package namespace, or that the package namespace 255 * was added to it, even if that parent is not a package object itself. 256 */ public 257 ListOfDeletions() throws org.sbml.libsbml.SBMLConstructorException { 258 this(libsbmlJNI.new_ListOfDeletions__SWIG_3(), true); 259 } 260 261 262/** 263 * Creates a new {@link ListOfDeletions} with the given {@link CompPkgNamespaces} object. 264 <p> 265 * <p> 266 * The package namespaces object used in this constructor is derived from a 267 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 268 * information. It is used to communicate the SBML Level, Version, and 269 * package version and name information used in addition to SBML Level 3 Core. A 270 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 271 * package namespace object somewhere in a program once, then hand that object 272 * as needed to object constructors of that package that accept it as and 273 * argument, such as this one. 274 <p> 275 * @param compns the {@link CompPkgNamespaces} object. 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 ListOfDeletions(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 297 this(libsbmlJNI.new_ListOfDeletions__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 298 } 299 300 301/** 302 * Get a {@link Deletion} from the {@link ListOfDeletions}. 303 <p> 304 * @param n the index number of the {@link Deletion} to get. 305 <p> 306 * @return the nth {@link Deletion} in this {@link ListOfDeletions}. 307 <p> 308 * @see #size() 309 */ public 310 SBase get(long n) { 311 long cPtr = libsbmlJNI.ListOfDeletions_get__SWIG_0(swigCPtr, this, n); 312 return (cPtr == 0) ? null : new Deletion(cPtr, false); 313 } 314 315 316/** 317 * Get a {@link Deletion} from the {@link ListOfDeletions} 318 * based on its identifier. 319 <p> 320 * @param sid a string representing the identifier 321 * of the {@link Deletion} to get. 322 <p> 323 * @return {@link Deletion} in this {@link ListOfDeletions} 324 * with the given <code>sid</code> or <code>null</code> if no such 325 * {@link Member} exists. 326 <p> 327 * @see #get(long n) 328 * @see #size() 329 */ public 330 Deletion get(String sid) { 331 long cPtr = libsbmlJNI.ListOfDeletions_get__SWIG_2(swigCPtr, this, sid); 332 return (cPtr == 0) ? null : new Deletion(cPtr, false); 333 } 334 335 336/** 337 * Removes the nth item from this {@link ListOfDeletions} items and returns a 338 * pointer to it. 339 <p> 340 * The caller owns the returned item and is responsible for deleting it. 341 <p> 342 * @param n the index of the item to remove. 343 <p> 344 * @see #size() 345 */ public 346 SBase remove(long n) { 347 long cPtr = libsbmlJNI.ListOfDeletions_remove__SWIG_0(swigCPtr, this, n); 348 return (cPtr == 0) ? null : new Deletion(cPtr, true); 349 } 350 351 352/** 353 * Removes an item from this {@link ListOfDeletions} items based on its identifier 354 * and returns a pointer to it. 355 <p> 356 * The caller owns the returned item and is responsible for deleting it. 357 <p> 358 * @param sid string representing the id of the item to remove. 359 <p> 360 * @see #size() 361 */ public 362 Deletion remove(String sid) { 363 long cPtr = libsbmlJNI.ListOfDeletions_remove__SWIG_1(swigCPtr, this, sid); 364 return (cPtr == 0) ? null : new Deletion(cPtr, true); 365 } 366 367 368/** 369 * Returns the libSBML type code for the objects contained in this {@link ListOf} 370 * (i.e., {@link Deletion} objects, if the list is non-empty). 371 <p> 372 * <p> 373 * LibSBML attaches an identifying code to every kind of SBML object. These 374 * are integer constants known as <em>SBML type codes</em>. The names of all 375 * the codes begin with the characters <code>SBML_</code>. 376 * In the Java language interface for libSBML, the 377 * type codes are defined as static integer constants in the interface class 378 * {@link libsbmlConstants}. Note that different Level 3 379 * package plug-ins may use overlapping type codes; to identify the package 380 * to which a given object belongs, call the <code>getPackageName()</code> 381 * method on the object. 382 <p> 383 * @return the SBML type code for objects contained in this list: 384 * {@link libsbmlConstants#SBML_COMP_DELETION SBML_COMP_DELETION} (default). 385 <p> 386 * @see #getElementName() 387 * @see #getPackageName() 388 */ public 389 int getItemTypeCode() { 390 return libsbmlJNI.ListOfDeletions_getItemTypeCode(swigCPtr, this); 391 } 392 393 394/** 395 * Returns the XML element name of this SBML object. 396 <p> 397 * @return the name of this element, as a text string. 398 */ public 399 String getElementName() { 400 return libsbmlJNI.ListOfDeletions_getElementName(swigCPtr, this); 401 } 402 403}