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