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