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