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