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