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-layout"><a href="group__layout.html">layout</a></span> 013 014 A list of {@link SpeciesGlyph} objects. 015 <p> 016 * The {@link ListOfSpeciesGlyphs} is a container for the {@link SpeciesGlyph} elements of a {@link Layout}. 017 <p> 018 * <p> 019 * The various ListOf___ classes in SBML 020 * are merely containers used for organizing the main components of an SBML 021 * model. In libSBML's implementation, ListOf___ 022 * classes are derived from the 023 * intermediate utility class {@link ListOf}, which 024 * is not defined by the SBML specifications but serves as a useful 025 * programmatic construct. {@link ListOf} is itself is in turn derived from {@link SBase}, 026 * which provides all of the various ListOf___ 027 * classes with common features 028 * defined by the SBML specification, such as 'metaid' attributes and 029 * annotations. 030 <p> 031 * The relationship between the lists and the rest of an SBML model is 032 * illustrated by the following (for SBML Level 2 Version 4): 033 <p> 034 * <figure> 035 <object type="image/svg+xml" data="listof-illustration.svg" class="centered"></object> 036</figure> 037 038 <p> 039 * SBML Level 3 Version 1 has essentially the same structure as 040 * Level 2 Version 4, depicted above, but SBML Level 3 041 * Version 2 allows 042 * containers to contain zero or more of the relevant object, instead of 043 * requiring at least one. As such, libsbml will write out an 044 * otherwise-empty ListOf___ element that has any optional attribute set 045 * (such as 'id' or 'metaid'), that has an optional child (such 046 * as a 'notes' or 'annotation'), or that has attributes or children set 047 * from any SBML Level 3 package, whether or not the ListOf___ has 048 * any other children. 049 <p> 050 * Readers may wonder about the motivations for using the ListOf___ 051 * containers in SBML. A simpler approach in XML might be to place the 052 * components all directly at the top level of the model definition. The 053 * choice made in SBML is to group them within XML elements named after 054 * ListOf<em>Classname</em>, in part because it helps organize the 055 * components. More importantly, the fact that the container classes are 056 * derived from {@link SBase} means that software tools can add information <em>about</em> 057 * the lists themselves into each list container's 'annotation'. 058 <p> 059 * @see ListOfFunctionDefinitions 060 * @see ListOfUnitDefinitions 061 * @see ListOfCompartmentTypes 062 * @see ListOfSpeciesTypes 063 * @see ListOfCompartments 064 * @see ListOfSpecies 065 * @see ListOfParameters 066 * @see ListOfInitialAssignments 067 * @see ListOfRules 068 * @see ListOfConstraints 069 * @see ListOfReactions 070 * @see ListOfEvents 071 <p> 072 * @see SpeciesGlyph 073 */ 074 075public class ListOfSpeciesGlyphs extends ListOf { 076 private long swigCPtr; 077 078 protected ListOfSpeciesGlyphs(long cPtr, boolean cMemoryOwn) 079 { 080 super(libsbmlJNI.ListOfSpeciesGlyphs_SWIGUpcast(cPtr), cMemoryOwn); 081 swigCPtr = cPtr; 082 } 083 084 protected static long getCPtr(ListOfSpeciesGlyphs obj) 085 { 086 return (obj == null) ? 0 : obj.swigCPtr; 087 } 088 089 protected static long getCPtrAndDisown (ListOfSpeciesGlyphs obj) 090 { 091 long ptr = 0; 092 093 if (obj != null) 094 { 095 ptr = obj.swigCPtr; 096 obj.swigCMemOwn = false; 097 } 098 099 return ptr; 100 } 101 102 protected void finalize() { 103 delete(); 104 } 105 106 public synchronized void delete() { 107 if (swigCPtr != 0) { 108 if (swigCMemOwn) { 109 swigCMemOwn = false; 110 libsbmlJNI.delete_ListOfSpeciesGlyphs(swigCPtr); 111 } 112 swigCPtr = 0; 113 } 114 super.delete(); 115 } 116 117 118/** 119 * Creates and returns a deep copy of this {@link ListOfSpeciesGlyphs}. 120 <p> 121 * @return a (deep) copy of this {@link ListOfSpeciesGlyphs}. 122 */ public 123 ListOfSpeciesGlyphs cloneObject() { 124 long cPtr = libsbmlJNI.ListOfSpeciesGlyphs_cloneObject(swigCPtr, this); 125 return (cPtr == 0) ? null : new ListOfSpeciesGlyphs(cPtr, true); 126 } 127 128 129/** 130 * Constructor. 131 <p> 132 * @param level the SBML Level. 133 * @param version the Version within the SBML Level. 134 * @param pkgVersion the version of the package. 135 <p> 136 * <p> 137 * @note Attempting to add an object to an {@link SBMLDocument} having a different 138 * combination of SBML Level, Version and XML namespaces than the object 139 * itself will result in an error at the time a caller attempts to make the 140 * addition. A parent object must have compatible Level, Version and XML 141 * namespaces. (Strictly speaking, a parent may also have more XML 142 * namespaces than a child, but the reverse is not permitted.) The 143 * restriction is necessary to ensure that an SBML model has a consistent 144 * overall structure. This requires callers to manage their objects 145 * carefully, but the benefit is increased flexibility in how models can be 146 * created by permitting callers to create objects bottom-up if desired. In 147 * situations where objects are not yet attached to parents (e.g., 148 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 149 * libSBML determine such things as whether it is valid to assign a 150 * particular value to an attribute. For packages, this means that the 151 * parent object to which this package element is being added must have 152 * been created with the package namespace, or that the package namespace 153 * was added to it, even if that parent is not a package object itself. 154 */ public 155 ListOfSpeciesGlyphs(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 156 this(libsbmlJNI.new_ListOfSpeciesGlyphs__SWIG_0(level, version, pkgVersion), true); 157 } 158 159 160/** 161 * Constructor. 162 <p> 163 * @param level the SBML Level. 164 * @param version the Version within the SBML Level. 165 * @param pkgVersion the version of the package. 166 <p> 167 * <p> 168 * @note Attempting to add an object to an {@link SBMLDocument} having a different 169 * combination of SBML Level, Version and XML namespaces than the object 170 * itself will result in an error at the time a caller attempts to make the 171 * addition. A parent object must have compatible Level, Version and XML 172 * namespaces. (Strictly speaking, a parent may also have more XML 173 * namespaces than a child, but the reverse is not permitted.) The 174 * restriction is necessary to ensure that an SBML model has a consistent 175 * overall structure. This requires callers to manage their objects 176 * carefully, but the benefit is increased flexibility in how models can be 177 * created by permitting callers to create objects bottom-up if desired. In 178 * situations where objects are not yet attached to parents (e.g., 179 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 180 * libSBML determine such things as whether it is valid to assign a 181 * particular value to an attribute. For packages, this means that the 182 * parent object to which this package element is being added must have 183 * been created with the package namespace, or that the package namespace 184 * was added to it, even if that parent is not a package object itself. 185 */ public 186 ListOfSpeciesGlyphs(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 187 this(libsbmlJNI.new_ListOfSpeciesGlyphs__SWIG_1(level, version), true); 188 } 189 190 191/** 192 * Constructor. 193 <p> 194 * @param level the SBML Level. 195 * @param version the Version within the SBML Level. 196 * @param pkgVersion the version of the package. 197 <p> 198 * <p> 199 * @note Attempting to add an object to an {@link SBMLDocument} having a different 200 * combination of SBML Level, Version and XML namespaces than the object 201 * itself will result in an error at the time a caller attempts to make the 202 * addition. A parent object must have compatible Level, Version and XML 203 * namespaces. (Strictly speaking, a parent may also have more XML 204 * namespaces than a child, but the reverse is not permitted.) The 205 * restriction is necessary to ensure that an SBML model has a consistent 206 * overall structure. This requires callers to manage their objects 207 * carefully, but the benefit is increased flexibility in how models can be 208 * created by permitting callers to create objects bottom-up if desired. In 209 * situations where objects are not yet attached to parents (e.g., 210 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 211 * libSBML determine such things as whether it is valid to assign a 212 * particular value to an attribute. For packages, this means that the 213 * parent object to which this package element is being added must have 214 * been created with the package namespace, or that the package namespace 215 * was added to it, even if that parent is not a package object itself. 216 */ public 217 ListOfSpeciesGlyphs(long level) throws org.sbml.libsbml.SBMLConstructorException { 218 this(libsbmlJNI.new_ListOfSpeciesGlyphs__SWIG_2(level), true); 219 } 220 221 222/** 223 * Constructor. 224 <p> 225 * @param level the SBML Level. 226 * @param version the Version within the SBML Level. 227 * @param pkgVersion the version of the package. 228 <p> 229 * <p> 230 * @note Attempting to add an object to an {@link SBMLDocument} having a different 231 * combination of SBML Level, Version and XML namespaces than the object 232 * itself will result in an error at the time a caller attempts to make the 233 * addition. A parent object must have compatible Level, Version and XML 234 * namespaces. (Strictly speaking, a parent may also have more XML 235 * namespaces than a child, but the reverse is not permitted.) The 236 * restriction is necessary to ensure that an SBML model has a consistent 237 * overall structure. This requires callers to manage their objects 238 * carefully, but the benefit is increased flexibility in how models can be 239 * created by permitting callers to create objects bottom-up if desired. In 240 * situations where objects are not yet attached to parents (e.g., 241 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 242 * libSBML determine such things as whether it is valid to assign a 243 * particular value to an attribute. For packages, this means that the 244 * parent object to which this package element is being added must have 245 * been created with the package namespace, or that the package namespace 246 * was added to it, even if that parent is not a package object itself. 247 */ public 248 ListOfSpeciesGlyphs() throws org.sbml.libsbml.SBMLConstructorException { 249 this(libsbmlJNI.new_ListOfSpeciesGlyphs__SWIG_3(), true); 250 } 251 252 253/** 254 * Constructor. 255 <p> 256 * <p> 257 * The package namespaces object used in this constructor is derived from a 258 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 259 * information. It is used to communicate the SBML Level, Version, and 260 * package version and name information used in addition to SBML Level 3 Core. A 261 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 262 * package namespace object somewhere in a program once, then hand that object 263 * as needed to object constructors of that package that accept it as and 264 * argument, such as this one. 265 <p> 266 * @param layoutns the {@link LayoutPkgNamespaces} object. 267 <p> 268 * <p> 269 * @note Attempting to add an object to an {@link SBMLDocument} having a different 270 * combination of SBML Level, Version and XML namespaces than the object 271 * itself will result in an error at the time a caller attempts to make the 272 * addition. A parent object must have compatible Level, Version and XML 273 * namespaces. (Strictly speaking, a parent may also have more XML 274 * namespaces than a child, but the reverse is not permitted.) The 275 * restriction is necessary to ensure that an SBML model has a consistent 276 * overall structure. This requires callers to manage their objects 277 * carefully, but the benefit is increased flexibility in how models can be 278 * created by permitting callers to create objects bottom-up if desired. In 279 * situations where objects are not yet attached to parents (e.g., 280 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 281 * libSBML determine such things as whether it is valid to assign a 282 * particular value to an attribute. For packages, this means that the 283 * parent object to which this package element is being added must have 284 * been created with the package namespace, or that the package namespace 285 * was added to it, even if that parent is not a package object itself. 286 */ public 287 ListOfSpeciesGlyphs(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 288 this(libsbmlJNI.new_ListOfSpeciesGlyphs__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 289 } 290 291 292/** 293 * Returns the libSBML type code for the SBML objects 294 * contained in this {@link ListOf} object. 295 <p> 296 * <p> 297 * LibSBML attaches an identifying code to every kind of SBML object. These 298 * are integer constants known as <em>SBML type codes</em>. The names of all 299 * the codes begin with the characters <code>SBML_</code>. 300 * In the Java language interface for libSBML, the 301 * type codes are defined as static integer constants in the interface class 302 * {@link libsbmlConstants}. Note that different Level 3 303 * package plug-ins may use overlapping type codes; to identify the package 304 * to which a given object belongs, call the <code>getPackageName()</code> 305 * method on the object. 306 <p> 307 * @return the SBML type code for objects contained in this list: 308 * {@link libsbmlConstants#SBML_LAYOUT_SPECIESGLYPH SBML_LAYOUT_SPECIESGLYPH} (default). 309 <p> 310 * @see #getElementName() 311 * @see #getPackageName() 312 */ public 313 int getItemTypeCode() { 314 return libsbmlJNI.ListOfSpeciesGlyphs_getItemTypeCode(swigCPtr, this); 315 } 316 317 318/** 319 * Returns the XML element name of 320 * this SBML object. 321 <p> 322 * @return the string of the name of this element. 323 */ public 324 String getElementName() { 325 return libsbmlJNI.ListOfSpeciesGlyphs_getElementName(swigCPtr, this); 326 } 327 328 329/** 330 * Get a {@link SpeciesGlyph} from the {@link ListOfSpeciesGlyphs}. 331 <p> 332 * @param n the index number of the {@link SpeciesGlyph} to get. 333 <p> 334 * @return the nth {@link SpeciesGlyph} in this {@link ListOfSpeciesGlyphs}. 335 <p> 336 * @see #size() 337 */ public 338 SpeciesGlyph get(long n) { 339 long cPtr = libsbmlJNI.ListOfSpeciesGlyphs_get__SWIG_0(swigCPtr, this, n); 340 return (cPtr == 0) ? null : new SpeciesGlyph(cPtr, false); 341 } 342 343 344/** 345 * Get a {@link SpeciesGlyph} from the {@link ListOfSpeciesGlyphs} 346 * based on its identifier. 347 <p> 348 * @param sid a string representing the identifier 349 * of the {@link SpeciesGlyph} to get. 350 <p> 351 * @return {@link SpeciesGlyph} in this {@link ListOfSpeciesGlyphs} 352 * with the given <code>sid</code> or <code>null</code> if no such 353 * {@link SpeciesGlyph} exists. 354 <p> 355 * @see #get(long n) 356 * @see #size() 357 */ public 358 SpeciesGlyph get(String sid) { 359 long cPtr = libsbmlJNI.ListOfSpeciesGlyphs_get__SWIG_2(swigCPtr, this, sid); 360 return (cPtr == 0) ? null : new SpeciesGlyph(cPtr, false); 361 } 362 363 364/** 365 * Removes the nth item from this {@link ListOfSpeciesGlyphs} items and returns a pointer to 366 * it. 367 <p> 368 * The caller owns the returned item and is responsible for deleting it. 369 <p> 370 * @param n the index of the item to remove. 371 <p> 372 * @see #size() 373 */ public 374 SpeciesGlyph remove(long n) { 375 long cPtr = libsbmlJNI.ListOfSpeciesGlyphs_remove__SWIG_0(swigCPtr, this, n); 376 return (cPtr == 0) ? null : new SpeciesGlyph(cPtr, true); 377 } 378 379 380/** 381 * Removes item in this {@link ListOfSpeciesGlyphs} items with the given identifier. 382 <p> 383 * The caller owns the returned item and is responsible for deleting it. 384 * If none of the items in this list have the identifier <code>sid</code>, then 385 * <code>null</code> is returned. 386 <p> 387 * @param sid the identifier of the item to remove. 388 <p> 389 * @return the item removed. As mentioned above, the caller owns the 390 * returned item. 391 */ public 392 SpeciesGlyph remove(String sid) { 393 long cPtr = libsbmlJNI.ListOfSpeciesGlyphs_remove__SWIG_1(swigCPtr, this, sid); 394 return (cPtr == 0) ? null : new SpeciesGlyph(cPtr, true); 395 } 396 397 398/** 399 * Creates an {@link XMLNode} object from this. 400 */ public 401 XMLNode toXML() { 402 return new XMLNode(libsbmlJNI.ListOfSpeciesGlyphs_toXML(swigCPtr, this), true); 403 } 404 405}