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 Submodel} objects. 014 <p> 015 * The {@link ListOfSubmodels} is a container for the extended 016 * {@link Model} that contains {@link Submodel} objects to be instantiated in that {@link Model}. 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 Submodel 054 * @see ListOfDeletions 055 * @see ListOfExternalModelDefinitions 056 * @see ListOfModelDefinitions 057 * @see ListOfPorts 058 * @see ListOfReplacedElements 059 */ 060 061public class ListOfSubmodels extends ListOf { 062 private long swigCPtr; 063 064 protected ListOfSubmodels(long cPtr, boolean cMemoryOwn) 065 { 066 super(libsbmlJNI.ListOfSubmodels_SWIGUpcast(cPtr), cMemoryOwn); 067 swigCPtr = cPtr; 068 } 069 070 protected static long getCPtr(ListOfSubmodels obj) 071 { 072 return (obj == null) ? 0 : obj.swigCPtr; 073 } 074 075 protected static long getCPtrAndDisown (ListOfSubmodels 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_ListOfSubmodels(swigCPtr); 097 } 098 swigCPtr = 0; 099 } 100 super.delete(); 101 } 102 103 104/** 105 * Creates and returns a deep copy of this {@link ListOfSubmodels} object. 106 <p> 107 * @return a (deep) copy of this {@link ListOfSubmodels}. 108 */ public 109 ListOfSubmodels cloneObject() { 110 long cPtr = libsbmlJNI.ListOfSubmodels_cloneObject(swigCPtr, this); 111 return (cPtr == 0) ? null : new ListOfSubmodels(cPtr, true); 112 } 113 114 115/** 116 * Creates a new {@link ListOfSubmodels} 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 ListOfSubmodels(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 124 this(libsbmlJNI.new_ListOfSubmodels__SWIG_0(level, version, pkgVersion), true); 125 } 126 127 128/** 129 * Creates a new {@link ListOfSubmodels} 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 ListOfSubmodels(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 137 this(libsbmlJNI.new_ListOfSubmodels__SWIG_1(level, version), true); 138 } 139 140 141/** 142 * Creates a new {@link ListOfSubmodels} 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 ListOfSubmodels(long level) throws org.sbml.libsbml.SBMLConstructorException { 150 this(libsbmlJNI.new_ListOfSubmodels__SWIG_2(level), true); 151 } 152 153 154/** 155 * Creates a new {@link ListOfSubmodels} 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 ListOfSubmodels() throws org.sbml.libsbml.SBMLConstructorException { 163 this(libsbmlJNI.new_ListOfSubmodels__SWIG_3(), true); 164 } 165 166 167/** 168 * Creates a new {@link ListOfSubmodels} with the given {@link CompPkgNamespaces} object. 169 <p> 170 * @param compns the namespace to use 171 */ public 172 ListOfSubmodels(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 173 this(libsbmlJNI.new_ListOfSubmodels__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 174 } 175 176 177/** 178 * Get a {@link Submodel} from the {@link ListOfSubmodels}. 179 <p> 180 * @param n the index number of the {@link Submodel} to get. 181 <p> 182 * @return the nth {@link Submodel} in this {@link ListOfSubmodels}. 183 <p> 184 * @see #size() 185 */ public 186 SBase get(long n) { 187 long cPtr = libsbmlJNI.ListOfSubmodels_get__SWIG_0(swigCPtr, this, n); 188 return (cPtr == 0) ? null : new Submodel(cPtr, false); 189 } 190 191 192/** 193 * Get a {@link Model} from the {@link ListOfSubmodels} 194 * based on its identifier. 195 <p> 196 * @param sid a string representing the identifier 197 * of the {@link Model} to get. 198 <p> 199 * @return {@link Model} in this {@link ListOfSubmodels} 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 Submodel get(String sid) { 207 long cPtr = libsbmlJNI.ListOfSubmodels_get__SWIG_2(swigCPtr, this, sid); 208 return (cPtr == 0) ? null : new Submodel(cPtr, false); 209 } 210 211 212/** 213 * Removes the nth item from this {@link ListOfSubmodels} 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.ListOfSubmodels_remove__SWIG_0(swigCPtr, this, n); 224 return (cPtr == 0) ? null : new Submodel(cPtr, true); 225 } 226 227 228/** 229 * Removes an item from this {@link ListOfSubmodels} 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 identifier of the item to remove 235 <p> 236 * @see #size() 237 */ public 238 Submodel remove(String sid) { 239 long cPtr = libsbmlJNI.ListOfSubmodels_remove__SWIG_1(swigCPtr, this, sid); 240 return (cPtr == 0) ? null : new Submodel(cPtr, true); 241 } 242 243 244/** 245 * Returns the libSBML type code for the objects contained in this {@link ListOf} 246 * (i.e., {@link Submodel} 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_SUBMODEL SBML_COMP_SUBMODEL} (default). 261 <p> 262 * @see #getElementName() 263 * @see #getPackageName() 264 */ public 265 int getItemTypeCode() { 266 return libsbmlJNI.ListOfSubmodels_getItemTypeCode(swigCPtr, this); 267 } 268 269 270/** 271 * Returns the XML element name of 272 * this SBML object. 273 <p> 274 * @return the name of this element, as a text string. 275 */ public 276 String getElementName() { 277 return libsbmlJNI.ListOfSubmodels_getElementName(swigCPtr, this); 278 } 279 280}