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