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 ListOfReplacedElements construct 014 * from the “comp” package. 015 <p> 016 * The {@link ListOfReplacedElements} is a container for any {@link SBase} object. It 017 * contains {@link ReplacedElement} objects, which point to elements the parent 018 * {@link SBase} object is to replace. 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 ReplacedElement 064 * @see ListOfDeletions 065 * @see ListOfExternalModelDefinitions 066 * @see ListOfModelDefinitions 067 * @see ListOfPorts 068 * @see ListOfSubmodels 069 */ 070 071public class ListOfReplacedElements extends ListOf { 072 private long swigCPtr; 073 074 protected ListOfReplacedElements(long cPtr, boolean cMemoryOwn) 075 { 076 super(libsbmlJNI.ListOfReplacedElements_SWIGUpcast(cPtr), cMemoryOwn); 077 swigCPtr = cPtr; 078 } 079 080 protected static long getCPtr(ListOfReplacedElements obj) 081 { 082 return (obj == null) ? 0 : obj.swigCPtr; 083 } 084 085 protected static long getCPtrAndDisown (ListOfReplacedElements 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_ListOfReplacedElements(swigCPtr); 107 } 108 swigCPtr = 0; 109 } 110 super.delete(); 111 } 112 113 114/** 115 * Creates and returns a deep copy of this {@link ListOfReplacedElements} object. 116 <p> 117 * @return a (deep) copy of this {@link ListOfReplacedElements}. 118 */ public 119 ListOfReplacedElements cloneObject() { 120 long cPtr = libsbmlJNI.ListOfReplacedElements_cloneObject(swigCPtr, this); 121 return (cPtr == 0) ? null : new ListOfReplacedElements(cPtr, true); 122 } 123 124 125/** 126 * Creates a new {@link ListOfReplacedElements} 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 ListOfReplacedElements(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 134 this(libsbmlJNI.new_ListOfReplacedElements__SWIG_0(level, version, pkgVersion), true); 135 } 136 137 138/** 139 * Creates a new {@link ListOfReplacedElements} 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 ListOfReplacedElements(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 147 this(libsbmlJNI.new_ListOfReplacedElements__SWIG_1(level, version), true); 148 } 149 150 151/** 152 * Creates a new {@link ListOfReplacedElements} 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 ListOfReplacedElements(long level) throws org.sbml.libsbml.SBMLConstructorException { 160 this(libsbmlJNI.new_ListOfReplacedElements__SWIG_2(level), true); 161 } 162 163 164/** 165 * Creates a new {@link ListOfReplacedElements} 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 ListOfReplacedElements() throws org.sbml.libsbml.SBMLConstructorException { 173 this(libsbmlJNI.new_ListOfReplacedElements__SWIG_3(), true); 174 } 175 176 177/** 178 * Creates a new {@link ListOfReplacedElements} with the given {@link CompPkgNamespaces} 179 * object. 180 <p> 181 * @param compns the namespace to use 182 */ public 183 ListOfReplacedElements(CompPkgNamespaces compns) throws org.sbml.libsbml.SBMLConstructorException { 184 this(libsbmlJNI.new_ListOfReplacedElements__SWIG_4(CompPkgNamespaces.getCPtr(compns), compns), true); 185 } 186 187 188/** 189 * Get a {@link ReplacedElement} from the {@link ListOfReplacedElements}. 190 <p> 191 * @param n the index number of the {@link ReplacedElement} to get. 192 <p> 193 * @return the nth {@link ReplacedElement} in this {@link ListOfReplacedElements}. 194 <p> 195 * @see #size() 196 */ public 197 SBase get(long n) { 198 long cPtr = libsbmlJNI.ListOfReplacedElements_get__SWIG_0(swigCPtr, this, n); 199 return (cPtr == 0) ? null : new ReplacedElement(cPtr, false); 200 } 201 202 203/** 204 * Removes the nth item from this {@link ListOfReplacedElements} items and returns 205 * a pointer to it. 206 <p> 207 * The caller owns the returned item and is responsible for deleting it. 208 <p> 209 * @param n the index of the item to remove 210 <p> 211 * @see #size() 212 */ public 213 SBase remove(long n) { 214 long cPtr = libsbmlJNI.ListOfReplacedElements_remove(swigCPtr, this, n); 215 return (cPtr == 0) ? null : new ReplacedElement(cPtr, true); 216 } 217 218 219/** 220 * Returns the libSBML type code for the objects contained in this {@link ListOf} 221 * (i.e., ReplacedElements objects, if the list is non-empty). 222 <p> 223 * <p> 224 * LibSBML attaches an identifying code to every kind of SBML object. These 225 * are integer constants known as <em>SBML type codes</em>. The names of all 226 * the codes begin with the characters “<code>SBML_</code>”. 227 * In the Java language interface for libSBML, the 228 * type codes are defined as static integer constants in the interface class 229 * {@link libsbmlConstants}. Note that different Level 3 230 * package plug-ins may use overlapping type codes; to identify the package 231 * to which a given object belongs, call the <code>getPackageName()</code> 232 * method on the object. 233 <p> 234 * @return the SBML type code for objects contained in this list: 235 * {@link libsbmlConstants#SBML_COMP_REPLACEDELEMENT SBML_COMP_REPLACEDELEMENT} (default). 236 <p> 237 * @see #getElementName() 238 * @see #getPackageName() 239 */ public 240 int getItemTypeCode() { 241 return libsbmlJNI.ListOfReplacedElements_getItemTypeCode(swigCPtr, this); 242 } 243 244 245/** 246 * Returns the XML element name of 247 * this SBML object. 248 <p> 249 * @return the string of the name of this element. 250 */ public 251 String getElementName() { 252 return libsbmlJNI.ListOfReplacedElements_getElementName(swigCPtr, this); 253 } 254 255}