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