001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.7 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 * A list of {@link EventAssignment} objects. 013 <p> 014 * <p> 015 * The various ListOf___ classes in SBML 016 * are merely containers used for organizing the main components of an SBML 017 * model. In libSBML's implementation, ListOf___ 018 * classes are derived from the 019 * intermediate utility class {@link ListOf}, which 020 * is not defined by the SBML specifications but serves as a useful 021 * programmatic construct. {@link ListOf} is itself is in turn derived from {@link SBase}, 022 * which provides all of the various ListOf___ 023 * classes with common features 024 * defined by the SBML specification, such as 'metaid' attributes and 025 * annotations. 026 <p> 027 * The relationship between the lists and the rest of an SBML model is 028 * illustrated by the following (for SBML Level 2 Version 4): 029 <p> 030 * <figure> 031 <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object> 032</figure> 033 034 <p> 035 * Readers may wonder about the motivations for using the ListOf___ 036 * containers in SBML. A simpler approach in XML might be to place the 037 * components all directly at the top level of the model definition. The 038 * choice made in SBML is to group them within XML elements named after 039 * ListOf<em>Classname</em>, in part because it helps organize the 040 * components. More importantly, the fact that the container classes are 041 * derived from {@link SBase} means that software tools can add information <em>about</em> 042 * the lists themselves into each list container's 'annotation'. 043 <p> 044 * @see ListOfFunctionDefinitions 045 * @see ListOfUnitDefinitions 046 * @see ListOfCompartmentTypes 047 * @see ListOfSpeciesTypes 048 * @see ListOfCompartments 049 * @see ListOfSpecies 050 * @see ListOfParameters 051 * @see ListOfInitialAssignments 052 * @see ListOfRules 053 * @see ListOfConstraints 054 * @see ListOfReactions 055 * @see ListOfEvents 056 */ 057 058public class ListOfEventAssignments extends ListOf { 059 private long swigCPtr; 060 061 protected ListOfEventAssignments(long cPtr, boolean cMemoryOwn) 062 { 063 super(libsbmlJNI.ListOfEventAssignments_SWIGUpcast(cPtr), cMemoryOwn); 064 swigCPtr = cPtr; 065 } 066 067 protected static long getCPtr(ListOfEventAssignments obj) 068 { 069 return (obj == null) ? 0 : obj.swigCPtr; 070 } 071 072 protected static long getCPtrAndDisown (ListOfEventAssignments obj) 073 { 074 long ptr = 0; 075 076 if (obj != null) 077 { 078 ptr = obj.swigCPtr; 079 obj.swigCMemOwn = false; 080 } 081 082 return ptr; 083 } 084 085 protected void finalize() { 086 delete(); 087 } 088 089 public synchronized void delete() { 090 if (swigCPtr != 0) { 091 if (swigCMemOwn) { 092 swigCMemOwn = false; 093 libsbmlJNI.delete_ListOfEventAssignments(swigCPtr); 094 } 095 swigCPtr = 0; 096 } 097 super.delete(); 098 } 099 100 101/** 102 * Creates a new {@link ListOfEventAssignments} object. 103 <p> 104 * The object is constructed such that it is valid for the given SBML 105 * Level and Version combination. 106 <p> 107 * @param level the SBML Level 108 <p> 109 * @param version the Version within the SBML Level 110 <p> 111 * <p> 112 * @throws SBMLConstructorException 113 * Thrown if the given <code>level</code> and <code>version</code> combination are invalid 114 * or if this object is incompatible with the given level and version. 115 <p> 116 * <p> 117 * @note Attempting to add an object to an {@link SBMLDocument} having a different 118 * combination of SBML Level, Version and XML namespaces than the object 119 * itself will result in an error at the time a caller attempts to make the 120 * addition. A parent object must have compatible Level, Version and XML 121 * namespaces. (Strictly speaking, a parent may also have more XML 122 * namespaces than a child, but the reverse is not permitted.) The 123 * restriction is necessary to ensure that an SBML model has a consistent 124 * overall structure. This requires callers to manage their objects 125 * carefully, but the benefit is increased flexibility in how models can be 126 * created by permitting callers to create objects bottom-up if desired. In 127 * situations where objects are not yet attached to parents (e.g., 128 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 129 * libSBML determine such things as whether it is valid to assign a 130 * particular value to an attribute. 131 */ public 132 ListOfEventAssignments(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 133 this(libsbmlJNI.new_ListOfEventAssignments__SWIG_0(level, version), true); 134 } 135 136 137/** 138 * Creates a new {@link ListOfEventAssignments} object. 139 <p> 140 * The object is constructed such that it is valid for the SBML Level and 141 * Version combination determined by the {@link SBMLNamespaces} object in 142 * <code>sbmlns</code>. 143 <p> 144 * @param sbmlns an {@link SBMLNamespaces} object that is used to determine the 145 * characteristics of the {@link ListOfEventAssignments} object to be created. 146 <p> 147 * <p> 148 * @throws SBMLConstructorException 149 * Thrown if the given <code>sbmlns</code> is inconsistent or incompatible 150 * with this object. 151 <p> 152 * <p> 153 * @note Attempting to add an object to an {@link SBMLDocument} having a different 154 * combination of SBML Level, Version and XML namespaces than the object 155 * itself will result in an error at the time a caller attempts to make the 156 * addition. A parent object must have compatible Level, Version and XML 157 * namespaces. (Strictly speaking, a parent may also have more XML 158 * namespaces than a child, but the reverse is not permitted.) The 159 * restriction is necessary to ensure that an SBML model has a consistent 160 * overall structure. This requires callers to manage their objects 161 * carefully, but the benefit is increased flexibility in how models can be 162 * created by permitting callers to create objects bottom-up if desired. In 163 * situations where objects are not yet attached to parents (e.g., 164 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 165 * libSBML determine such things as whether it is valid to assign a 166 * particular value to an attribute. 167 */ public 168 ListOfEventAssignments(SBMLNamespaces sbmlns) throws org.sbml.libsbml.SBMLConstructorException { 169 this(libsbmlJNI.new_ListOfEventAssignments__SWIG_1(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true); 170 } 171 172 173/** 174 * Creates and returns a deep copy of this {@link ListOfEventAssignments} object. 175 <p> 176 * @return the (deep) copy of this {@link ListOfEventAssignments} object. 177 */ public 178 ListOfEventAssignments cloneObject() { 179 long cPtr = libsbmlJNI.ListOfEventAssignments_cloneObject(swigCPtr, this); 180 return (cPtr == 0) ? null : new ListOfEventAssignments(cPtr, true); 181 } 182 183 184/** 185 * Returns the libSBML type code for the objects contained in this {@link ListOf} 186 * (i.e., {@link EventAssignment} objects, if the list is non-empty). 187 <p> 188 * <p> 189 * LibSBML attaches an identifying code to every kind of SBML object. These 190 * are integer constants known as <em>SBML type codes</em>. The names of all 191 * the codes begin with the characters <code>SBML_</code>. 192 * In the Java language interface for libSBML, the 193 * type codes are defined as static integer constants in the interface class 194 * {@link libsbmlConstants}. Note that different Level 3 195 * package plug-ins may use overlapping type codes; to identify the package 196 * to which a given object belongs, call the <code>getPackageName()</code> 197 * method on the object. 198 <p> 199 * @return the SBML type code for the objects contained in this ListOf: 200 * {@link libsbmlConstants#SBML_EVENT_ASSIGNMENT SBML_EVENT_ASSIGNMENT} (default). 201 <p> 202 * @see #getElementName() 203 * @see #getPackageName() 204 */ public 205 int getItemTypeCode() { 206 return libsbmlJNI.ListOfEventAssignments_getItemTypeCode(swigCPtr, this); 207 } 208 209 210/** 211 * Returns the XML element name of this object. 212 <p> 213 * For {@link ListOfEventAssignments}, the XML element name is 214 * <code>'listOfEventAssignments'.</code> 215 <p> 216 * @return the name of this element, i.e., <code>'listOfEventAssignments'.</code> 217 */ public 218 String getElementName() { 219 return libsbmlJNI.ListOfEventAssignments_getElementName(swigCPtr, this); 220 } 221 222 223/** 224 * Get a {@link EventAssignment} from the {@link ListOfEventAssignments}. 225 <p> 226 * @param n the index number of the {@link EventAssignment} to get. 227 <p> 228 * @return the nth {@link EventAssignment} in this {@link ListOfEventAssignments}. 229 <p> 230 * @see #size() 231 */ public 232 EventAssignment get(long n) { 233 long cPtr = libsbmlJNI.ListOfEventAssignments_get__SWIG_0(swigCPtr, this, n); 234 return (cPtr == 0) ? null : new EventAssignment(cPtr, false); 235 } 236 237 238/** 239 * Get a {@link EventAssignment} from the {@link ListOfEventAssignments} 240 * based on its identifier. 241 <p> 242 * @param sid a string representing the identifier 243 * of the {@link EventAssignment} to get. 244 <p> 245 * @return {@link EventAssignment} in this {@link ListOfEventAssignments} 246 * with the given <code>sid</code> or <code>null</code> if no such 247 * {@link EventAssignment} exists. 248 <p> 249 * @see #get(long n) 250 * @see #size() 251 */ public 252 EventAssignment get(String sid) { 253 long cPtr = libsbmlJNI.ListOfEventAssignments_get__SWIG_2(swigCPtr, this, sid); 254 return (cPtr == 0) ? null : new EventAssignment(cPtr, false); 255 } 256 257 258/** 259 * Removes the nth item from this {@link ListOfEventAssignments} items and returns 260 * a pointer to it. 261 <p> 262 * The caller owns the returned item and is responsible for deleting it. 263 <p> 264 * @param n the index of the item to remove 265 <p> 266 * @see #size() 267 */ public 268 EventAssignment remove(long n) { 269 long cPtr = libsbmlJNI.ListOfEventAssignments_remove__SWIG_0(swigCPtr, this, n); 270 return (cPtr == 0) ? null : new EventAssignment(cPtr, true); 271 } 272 273 274/** 275 * Removes item in this {@link ListOfEventAssignments} items with the given 276 * identifier. 277 <p> 278 * The caller owns the returned item and is responsible for deleting it. 279 * If none of the items in this list have the identifier <code>sid</code>, then 280 * <code>null</code> is returned. 281 <p> 282 * @param sid the identifier of the item to remove 283 <p> 284 * @return the item removed. As mentioned above, the caller owns the 285 * returned item. 286 */ public 287 EventAssignment remove(String sid) { 288 long cPtr = libsbmlJNI.ListOfEventAssignments_remove__SWIG_1(swigCPtr, this, sid); 289 return (cPtr == 0) ? null : new EventAssignment(cPtr, true); 290 } 291 292 293/** 294 * Returns the first child element found that has the given <code>id</code> in the 295 * model-wide SId namespace, or <code>null</code> if no such object is found. 296 <p> 297 * Note that EventAssignments do not actually have IDs, but the libsbml 298 * interface pretends that they do: no event assignment is returned by this 299 * function. 300 <p> 301 * @param id string representing the id of objects to find 302 <p> 303 * @return pointer to the first element found with the given <code>id</code>. 304 */ public 305 SBase getElementBySId(String id) { 306 return libsbml.DowncastSBase(libsbmlJNI.ListOfEventAssignments_getElementBySId(swigCPtr, this, id), false); 307} 308 309}