001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.7 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 * Readers may wonder about the motivations for using the ListOf___ 040 * containers in SBML. A simpler approach in XML might be to place the 041 * components all directly at the top level of the model definition. The 042 * choice made in SBML is to group them within XML elements named after 043 * ListOf<em>Classname</em>, in part because it helps organize the 044 * components. More importantly, the fact that the container classes are 045 * derived from {@link SBase} means that software tools can add information <em>about</em> 046 * the lists themselves into each list container's 'annotation'. 047 <p> 048 * @see ListOfFunctionDefinitions 049 * @see ListOfUnitDefinitions 050 * @see ListOfCompartmentTypes 051 * @see ListOfSpeciesTypes 052 * @see ListOfCompartments 053 * @see ListOfSpecies 054 * @see ListOfParameters 055 * @see ListOfInitialAssignments 056 * @see ListOfRules 057 * @see ListOfConstraints 058 * @see ListOfReactions 059 * @see ListOfEvents 060 <p> 061 * @see Deletion 062 * @see ListOfExternalModelDefinitions 063 * @see ListOfModelDefinitions 064 * @see ListOfPorts 065 * @see ListOfReplacedElements 066 * @see ListOfSubmodels 067 */ 068 069public class ListOfDeletions extends ListOf { 070 private long swigCPtr; 071 072 protected ListOfDeletions(long cPtr, boolean cMemoryOwn) 073 { 074 super(libsbmlJNI.ListOfDeletions_SWIGUpcast(cPtr), cMemoryOwn); 075 swigCPtr = cPtr; 076 } 077 078 protected static long getCPtr(ListOfDeletions obj) 079 { 080 return (obj == null) ? 0 : obj.swigCPtr; 081 } 082 083 protected static long getCPtrAndDisown (ListOfDeletions obj) 084 { 085 long ptr = 0; 086 087 if (obj != null) 088 { 089 ptr = obj.swigCPtr; 090 obj.swigCMemOwn = false; 091 } 092 093 return ptr; 094 } 095 096 protected void finalize() { 097 delete(); 098 } 099 100 public synchronized void delete() { 101 if (swigCPtr != 0) { 102 if (swigCMemOwn) { 103 swigCMemOwn = false; 104 libsbmlJNI.delete_ListOfDeletions(swigCPtr); 105 } 106 swigCPtr = 0; 107 } 108 super.delete(); 109 } 110 111 112/** 113 * Creates and returns a deep copy of this {@link ListOfDeletions} object. 114 <p> 115 * @return a (deep) copy of this {@link ListOfDeletions}. 116 */ public 117 ListOfDeletions cloneObject() { 118 long cPtr = libsbmlJNI.ListOfDeletions_cloneObject(swigCPtr, this); 119 return (cPtr == 0) ? null : new ListOfDeletions(cPtr, true); 120 } 121 122 123/** 124 * Creates a new {@link ListOfDeletions} with the given level, version, and package 125 * version. 126 <p> 127 * @param level the SBML Level 128 * @param version the Version within the SBML Level 129 * @param pkgVersion the version of the package 130 */ public 131 ListOfDeletions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 132 this(libsbmlJNI.new_ListOfDeletions__SWIG_0(level, version, pkgVersion), true); 133 } 134 135 136/** 137 * Creates a new {@link ListOfDeletions} with the given level, version, and package 138 * version. 139 <p> 140 * @param level the SBML Level 141 * @param version the Version within the SBML Level 142 * @param pkgVersion the version of the package 143 */ public 144 ListOfDeletions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 145 this(libsbmlJNI.new_ListOfDeletions__SWIG_1(level, version), true); 146 } 147 148 149/** 150 * Creates a new {@link ListOfDeletions} with the given level, version, and package 151 * version. 152 <p> 153 * @param level the SBML Level 154 * @param version the Version within the SBML Level 155 * @param pkgVersion the version of the package 156 */ public 157 ListOfDeletions(long level) throws org.sbml.libsbml.SBMLConstructorException { 158 this(libsbmlJNI.new_ListOfDeletions__SWIG_2(level), true); 159 } 160 161 162/** 163 * Creates a new {@link ListOfDeletions} with the given level, version, and package 164 * version. 165 <p> 166 * @param level the SBML Level 167 * @param version the Version within the SBML Level 168 * @param pkgVersion the version of the package 169 */ public 170 ListOfDeletions() throws org.sbml.libsbml.SBMLConstructorException { 171 this(libsbmlJNI.new_ListOfDeletions__SWIG_3(), true); 172 } 173 174 175/** 176 * Creates a new {@link ListOfDeletions} with the given {@link CompPkgNamespaces} object. 177 <p> 178 * @param compns the namespace to use 179 */ public 180 ListOfDeletions(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 181 this(libsbmlJNI.new_ListOfDeletions__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 182 } 183 184 185/** 186 * Get a {@link Deletion} from the {@link ListOfDeletions}. 187 <p> 188 * @param n the index number of the {@link Deletion} to get. 189 <p> 190 * @return the nth {@link Deletion} in this {@link ListOfDeletions}. 191 <p> 192 * @see #size() 193 */ public 194 SBase get(long n) { 195 long cPtr = libsbmlJNI.ListOfDeletions_get__SWIG_0(swigCPtr, this, n); 196 return (cPtr == 0) ? null : new Deletion(cPtr, false); 197 } 198 199 200/** 201 * Get a {@link Deletion} from the {@link ListOfDeletions} 202 * based on its identifier. 203 <p> 204 * @param sid a string representing the identifier 205 * of the {@link Deletion} to get. 206 <p> 207 * @return {@link Deletion} in this {@link ListOfDeletions} 208 * with the given <code>sid</code> or <code>null</code> if no such 209 * Member exists. 210 <p> 211 * @see #get(long n) 212 * @see #size() 213 */ public 214 Deletion get(String sid) { 215 long cPtr = libsbmlJNI.ListOfDeletions_get__SWIG_2(swigCPtr, this, sid); 216 return (cPtr == 0) ? null : new Deletion(cPtr, false); 217 } 218 219 220/** 221 * Removes the nth item from this {@link ListOfDeletions} items and returns a 222 * pointer to it. 223 <p> 224 * The caller owns the returned item and is responsible for deleting it. 225 <p> 226 * @param n the index of the item to remove 227 <p> 228 * @see #size() 229 */ public 230 SBase remove(long n) { 231 long cPtr = libsbmlJNI.ListOfDeletions_remove__SWIG_0(swigCPtr, this, n); 232 return (cPtr == 0) ? null : new Deletion(cPtr, true); 233 } 234 235 236/** 237 * Removes an item from this {@link ListOfDeletions} items based on its identifier 238 * and returns a pointer to it. 239 <p> 240 * The caller owns the returned item and is responsible for deleting it. 241 <p> 242 * @param sid string representing the id of the item to remove 243 <p> 244 * @see #size() 245 */ public 246 Deletion remove(String sid) { 247 long cPtr = libsbmlJNI.ListOfDeletions_remove__SWIG_1(swigCPtr, this, sid); 248 return (cPtr == 0) ? null : new Deletion(cPtr, true); 249 } 250 251 252/** 253 * Returns the libSBML type code for the objects contained in this {@link ListOf} 254 * (i.e., {@link Deletion} objects, if the list is non-empty). 255 <p> 256 * <p> 257 * LibSBML attaches an identifying code to every kind of SBML object. These 258 * are integer constants known as <em>SBML type codes</em>. The names of all 259 * the codes begin with the characters <code>SBML_</code>. 260 * In the Java language interface for libSBML, the 261 * type codes are defined as static integer constants in the interface class 262 * {@link libsbmlConstants}. Note that different Level 3 263 * package plug-ins may use overlapping type codes; to identify the package 264 * to which a given object belongs, call the <code>getPackageName()</code> 265 * method on the object. 266 <p> 267 * @return the SBML type code for objects contained in this list: 268 * {@link libsbmlConstants#SBML_COMP_DELETION SBML_COMP_DELETION} (default). 269 <p> 270 * @see #getElementName() 271 * @see #getPackageName() 272 */ public 273 int getItemTypeCode() { 274 return libsbmlJNI.ListOfDeletions_getItemTypeCode(swigCPtr, this); 275 } 276 277 278/** 279 * Returns the XML element name of this SBML object. 280 <p> 281 * @return the name of this element, as a text string. 282 */ public 283 String getElementName() { 284 return libsbmlJNI.ListOfDeletions_getElementName(swigCPtr, this); 285 } 286 287}