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 ListOfExternalModelDefinitions 014 * construct from the “comp” package. 015 <p> 016 * The {@link ListOfExternalModelDefinitions} is a container for the extended 017 * {@link SBMLDocument} that defines references to Models defined in external 018 * files. 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 ExternalModelDefinition 064 * @see ListOfDeletions 065 * @see ListOfModelDefinitions 066 * @see ListOfPorts 067 * @see ListOfReplacedElements 068 * @see ListOfSubmodels 069 */ 070 071public class ListOfExternalModelDefinitions extends ListOf { 072 private long swigCPtr; 073 074 protected ListOfExternalModelDefinitions(long cPtr, boolean cMemoryOwn) 075 { 076 super(libsbmlJNI.ListOfExternalModelDefinitions_SWIGUpcast(cPtr), cMemoryOwn); 077 swigCPtr = cPtr; 078 } 079 080 protected static long getCPtr(ListOfExternalModelDefinitions obj) 081 { 082 return (obj == null) ? 0 : obj.swigCPtr; 083 } 084 085 protected static long getCPtrAndDisown (ListOfExternalModelDefinitions 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_ListOfExternalModelDefinitions(swigCPtr); 107 } 108 swigCPtr = 0; 109 } 110 super.delete(); 111 } 112 113 114/** 115 * Creates and returns a deep copy of this {@link ListOfExternalModelDefinitions} object. 116 <p> 117 * @return a (deep) copy of this {@link ListOfExternalModelDefinitions}. 118 */ public 119 ListOfExternalModelDefinitions cloneObject() { 120 long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_cloneObject(swigCPtr, this); 121 return (cPtr == 0) ? null : new ListOfExternalModelDefinitions(cPtr, true); 122 } 123 124 125/** 126 * Creates a new {@link ListOfExternalModelDefinitions} with the given level, 127 * version, and 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 ListOfExternalModelDefinitions(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 134 this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_0(level, version, pkgVersion), true); 135 } 136 137 138/** 139 * Creates a new {@link ListOfExternalModelDefinitions} with the given level, 140 * version, and 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 ListOfExternalModelDefinitions(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 147 this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_1(level, version), true); 148 } 149 150 151/** 152 * Creates a new {@link ListOfExternalModelDefinitions} with the given level, 153 * version, and 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 ListOfExternalModelDefinitions(long level) throws org.sbml.libsbml.SBMLConstructorException { 160 this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_2(level), true); 161 } 162 163 164/** 165 * Creates a new {@link ListOfExternalModelDefinitions} with the given level, 166 * version, and 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 ListOfExternalModelDefinitions() throws org.sbml.libsbml.SBMLConstructorException { 173 this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_3(), true); 174 } 175 176 177/** 178 * Creates a new {@link ListOfExternalModelDefinitions} with the given 179 * {@link CompPkgNamespaces} object. 180 <p> 181 * @param compns the namespace to use 182 */ public 183 ListOfExternalModelDefinitions(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 184 this(libsbmlJNI.new_ListOfExternalModelDefinitions__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 185 } 186 187 188/** 189 * Get a {@link ExternalModelDefinition} from the {@link ListOfExternalModelDefinitions}. 190 <p> 191 * @param n the index number of the {@link ExternalModelDefinition} to get. 192 <p> 193 * @return the nth {@link ExternalModelDefinition} in this 194 * {@link ListOfExternalModelDefinitions}. 195 <p> 196 * @see #size() 197 */ public 198 SBase get(long n) { 199 long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_get__SWIG_0(swigCPtr, this, n); 200 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false); 201 } 202 203 204/** 205 * Get a {@link Model} from the {@link ListOfExternalModelDefinitions} 206 * based on its identifier. 207 <p> 208 * @param sid a string representing the identifier 209 * of the {@link Model} to get. 210 <p> 211 * @return {@link Model} in this {@link ListOfExternalModelDefinitions} 212 * with the given <code>sid</code> or <code>null</code> if no such 213 * Member exists. 214 <p> 215 * @see #get(long n) 216 * @see #size() 217 */ public 218 ExternalModelDefinition get(String sid) { 219 long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_get__SWIG_2(swigCPtr, this, sid); 220 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, false); 221 } 222 223 224/** 225 * Removes the nth item from this {@link ListOfExternalModelDefinitions} items and 226 * returns a pointer to it. 227 <p> 228 * The caller owns the returned item and is responsible for deleting it. 229 <p> 230 * @param n the index of the item to remove 231 <p> 232 * @see #size() 233 */ public 234 SBase remove(long n) { 235 long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_remove__SWIG_0(swigCPtr, this, n); 236 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, true); 237 } 238 239 240/** 241 * Removes the item with given <code>sid</code> from this {@link ListOfModelDefinitions} items 242 * and returns a pointer to it. 243 <p> 244 * The caller owns the returned item and is responsible for deleting it. 245 <p> 246 * @param sid the id of the item to remove 247 <p> 248 * @see #size() 249 */ public 250 ExternalModelDefinition remove(String sid) { 251 long cPtr = libsbmlJNI.ListOfExternalModelDefinitions_remove__SWIG_1(swigCPtr, this, sid); 252 return (cPtr == 0) ? null : new ExternalModelDefinition(cPtr, true); 253 } 254 255 256/** 257 * Returns the libSBML type code for the objects contained in this {@link ListOf} 258 * (i.e., {@link Model} objects, if the list is non-empty). 259 <p> 260 * <p> 261 * LibSBML attaches an identifying code to every kind of SBML object. These 262 * are integer constants known as <em>SBML type codes</em>. The names of all 263 * the codes begin with the characters “<code>SBML_</code>”. 264 * In the Java language interface for libSBML, the 265 * type codes are defined as static integer constants in the interface class 266 * {@link libsbmlConstants}. Note that different Level 3 267 * package plug-ins may use overlapping type codes; to identify the package 268 * to which a given object belongs, call the <code>getPackageName()</code> 269 * method on the object. 270 <p> 271 * @return the SBML type code for objects contained in this list: 272 * {@link libsbmlConstants#SBML_COMP_EXTERNALMODELDEFINITION SBML_COMP_EXTERNALMODELDEFINITION} (default). 273 <p> 274 * @see #getElementName() 275 * @see #getPackageName() 276 */ public 277 int getItemTypeCode() { 278 return libsbmlJNI.ListOfExternalModelDefinitions_getItemTypeCode(swigCPtr, this); 279 } 280 281 282/** 283 * Returns the XML element name of 284 * this SBML object. 285 <p> 286 * @return the string of the name of this element. 287 */ public 288 String getElementName() { 289 return libsbmlJNI.ListOfExternalModelDefinitions_getElementName(swigCPtr, this); 290 } 291 292}