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