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 The ReactionGlyph is used to represent {@link Reaction} 015 * elements in the layout. 016 <p> 017 * Analogous to how a {@link Reaction} object has to at least have one reactant or 018 * product, the {@link ReactionGlyph} has to at least have one {@link SpeciesReferenceGlyph} 019 * stored in the {@link ListOfSpeciesReferenceGlyphs}. Figure 12 on the following 020 * page provides the UML diagram for the class definition. The {@link ReactionGlyph} 021 * inherits from {@link GraphicalObject}. In addition to the attributes inherited 022 * from {@link GraphicalObject}, the {@link ReactionGlyph} is described by an attribute 023 * reaction, a {@link Curve} element and a listOfSpeciesReferenceGlyphs element. The 024 * {@link Curve} describes the center section of a {@link ReactionGlyph}. The center section 025 * is frequently used by tools to separate the point where substrates arcs 026 * come together, from the point where product arcs split off. The {@link Curve} is 027 * optional, and when not present the dimensions of the inherited {@link BoundingBox} 028 * describes the center section, by storing its position and dimension. 029 */ 030 031public class ReactionGlyph extends GraphicalObject { 032 private long swigCPtr; 033 034 protected ReactionGlyph(long cPtr, boolean cMemoryOwn) 035 { 036 super(libsbmlJNI.ReactionGlyph_SWIGUpcast(cPtr), cMemoryOwn); 037 swigCPtr = cPtr; 038 } 039 040 protected static long getCPtr(ReactionGlyph obj) 041 { 042 return (obj == null) ? 0 : obj.swigCPtr; 043 } 044 045 protected static long getCPtrAndDisown (ReactionGlyph obj) 046 { 047 long ptr = 0; 048 049 if (obj != null) 050 { 051 ptr = obj.swigCPtr; 052 obj.swigCMemOwn = false; 053 } 054 055 return ptr; 056 } 057 058 protected void finalize() { 059 delete(); 060 } 061 062 public synchronized void delete() { 063 if (swigCPtr != 0) { 064 if (swigCMemOwn) { 065 swigCMemOwn = false; 066 libsbmlJNI.delete_ReactionGlyph(swigCPtr); 067 } 068 swigCPtr = 0; 069 } 070 super.delete(); 071 } 072 073 074/** 075 * Creates a new {@link ReactionGlyph}. The list of species reference glyph is 076 * empty and the id of the associated reaction is set to the empty 077 * string. 078 */ public 079 ReactionGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 080 this(libsbmlJNI.new_ReactionGlyph__SWIG_0(level, version, pkgVersion), true); 081 } 082 083 084/** 085 * Creates a new {@link ReactionGlyph}. The list of species reference glyph is 086 * empty and the id of the associated reaction is set to the empty 087 * string. 088 */ public 089 ReactionGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 090 this(libsbmlJNI.new_ReactionGlyph__SWIG_1(level, version), true); 091 } 092 093 094/** 095 * Creates a new {@link ReactionGlyph}. The list of species reference glyph is 096 * empty and the id of the associated reaction is set to the empty 097 * string. 098 */ public 099 ReactionGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException { 100 this(libsbmlJNI.new_ReactionGlyph__SWIG_2(level), true); 101 } 102 103 104/** 105 * Creates a new {@link ReactionGlyph}. The list of species reference glyph is 106 * empty and the id of the associated reaction is set to the empty 107 * string. 108 */ public 109 ReactionGlyph() throws org.sbml.libsbml.SBMLConstructorException { 110 this(libsbmlJNI.new_ReactionGlyph__SWIG_3(), true); 111 } 112 113 114/** 115 * Creates a new {@link ReactionGlyph} with the given {@link LayoutPkgNamespaces} object. 116 */ public 117 ReactionGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 118 this(libsbmlJNI.new_ReactionGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 119 } 120 121 122/** 123 * Creates a ResctionGlyph with the given {@link LayoutPkgNamespaces} and id. 124 <p> 125 * (FOR BACKWARD COMPATIBILITY) 126 */ public 127 ReactionGlyph(LayoutPkgNamespaces layoutns, String id) throws org.sbml.libsbml.SBMLConstructorException { 128 this(libsbmlJNI.new_ReactionGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id), true); 129 } 130 131 132/** 133 * Creates a ResctionGlyph with the given {@link LayoutPkgNamespaces}, id and set the id of the 134 * associated reaction to the second argument. 135 <p> 136 * (FOR BACKWARD COMPATIBILITY) 137 */ public 138 ReactionGlyph(LayoutPkgNamespaces layoutns, String id, String reactionId) throws org.sbml.libsbml.SBMLConstructorException { 139 this(libsbmlJNI.new_ReactionGlyph__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, reactionId), true); 140 } 141 142 143/** 144 * Creates a new {@link ReactionGlyph} from the given {@link XMLNode} 145 <p> 146 * (FOR BACKWARD COMPATIBILITY) 147 */ public 148 ReactionGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 149 this(libsbmlJNI.new_ReactionGlyph__SWIG_7(XMLNode.getCPtr(node), node, l2version), true); 150 } 151 152 153/** 154 * Creates a new {@link ReactionGlyph} from the given {@link XMLNode} 155 <p> 156 * (FOR BACKWARD COMPATIBILITY) 157 */ public 158 ReactionGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 159 this(libsbmlJNI.new_ReactionGlyph__SWIG_8(XMLNode.getCPtr(node), node), true); 160 } 161 162 163/** 164 * Copy constructor. 165 */ public 166 ReactionGlyph(ReactionGlyph source) throws org.sbml.libsbml.SBMLConstructorException { 167 this(libsbmlJNI.new_ReactionGlyph__SWIG_9(ReactionGlyph.getCPtr(source), source), true); 168 } 169 170 171/** 172 * Returns the id of the associated reaction. 173 */ public 174 String getReactionId() { 175 return libsbmlJNI.ReactionGlyph_getReactionId(swigCPtr, this); 176 } 177 178 179/** 180 * Sets the id of the associated reaction. 181 */ public 182 int setReactionId(String id) { 183 return libsbmlJNI.ReactionGlyph_setReactionId(swigCPtr, this, id); 184 } 185 186 187/** 188 * Returns true if the id of the associated reaction is not the empty 189 * string. 190 */ public 191 boolean isSetReactionId() { 192 return libsbmlJNI.ReactionGlyph_isSetReactionId(swigCPtr, this); 193 } 194 195 196/** 197 * Returns the {@link ListOf} object that hold the species reference glyphs. 198 */ public 199 ListOfSpeciesReferenceGlyphs getListOfSpeciesReferenceGlyphs() { 200 long cPtr = libsbmlJNI.ReactionGlyph_getListOfSpeciesReferenceGlyphs(swigCPtr, this); 201 return (cPtr == 0) ? null : new ListOfSpeciesReferenceGlyphs(cPtr, false); 202 } 203 204 205/** 206 * Returns the species reference glyph with the given index. 207 * If the index is invalid, <code>null</code> is returned. 208 */ public 209 SpeciesReferenceGlyph getSpeciesReferenceGlyph(long index) { 210 long cPtr = libsbmlJNI.ReactionGlyph_getSpeciesReferenceGlyph__SWIG_0(swigCPtr, this, index); 211 return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, false); 212 } 213 214 215/** 216 * Adds a new species reference glyph to the list. 217 */ public 218 void addSpeciesReferenceGlyph(SpeciesReferenceGlyph glyph) { 219 libsbmlJNI.ReactionGlyph_addSpeciesReferenceGlyph(swigCPtr, this, SpeciesReferenceGlyph.getCPtr(glyph), glyph); 220 } 221 222 223/** 224 * Returns the number of species reference glyph objects. 225 */ public 226 long getNumSpeciesReferenceGlyphs() { 227 return libsbmlJNI.ReactionGlyph_getNumSpeciesReferenceGlyphs(swigCPtr, this); 228 } 229 230 231/** 232 * Calls initDefaults from {@link GraphicalObject}. 233 */ public 234 void initDefaults() { 235 libsbmlJNI.ReactionGlyph_initDefaults(swigCPtr, this); 236 } 237 238 239/** 240 * Renames all the <code>SIdRef</code> attributes on this element, including any 241 * found in MathML content (if such exists). 242 <p> 243 * This method works by looking at all attributes and (if appropriate) 244 * mathematical formulas, comparing the identifiers to the value of 245 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 246 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 247 <p> 248 * @param oldid the old identifier 249 * @param newid the new identifier 250 */ public 251 void renameSIdRefs(String oldid, String newid) { 252 libsbmlJNI.ReactionGlyph_renameSIdRefs(swigCPtr, this, oldid, newid); 253 } 254 255 256/** 257 * Returns the curve object for the reaction glyph 258 */ public 259 Curve getCurve() { 260 long cPtr = libsbmlJNI.ReactionGlyph_getCurve__SWIG_0(swigCPtr, this); 261 return (cPtr == 0) ? null : new Curve(cPtr, false); 262 } 263 264 265/** 266 * Sets the curve object for the reaction glyph. 267 */ public 268 void setCurve(Curve curve) { 269 libsbmlJNI.ReactionGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve); 270 } 271 272 273/** 274 * Returns true if the curve consists of one or more segments. 275 */ public 276 boolean isSetCurve() { 277 return libsbmlJNI.ReactionGlyph_isSetCurve(swigCPtr, this); 278 } 279 280 281/** */ public 282 boolean getCurveExplicitlySet() { 283 return libsbmlJNI.ReactionGlyph_getCurveExplicitlySet(swigCPtr, this); 284 } 285 286 287/** 288 * Creates a new {@link SpeciesReferenceGlyph} object, adds it to the end of the 289 * list of species reference objects and returns a reference to the newly 290 * created object. 291 */ public 292 SpeciesReferenceGlyph createSpeciesReferenceGlyph() { 293 long cPtr = libsbmlJNI.ReactionGlyph_createSpeciesReferenceGlyph(swigCPtr, this); 294 return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, false); 295 } 296 297 298/** 299 * Creates a new {@link LineSegment} object, adds it to the end of the list of 300 * curve segment objects of the curve and returns a reference to the 301 * newly created object. 302 */ public 303 LineSegment createLineSegment() { 304 return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.ReactionGlyph_createLineSegment(swigCPtr, this), false); 305} 306 307 308/** 309 * Creates a new {@link CubicBezier} object, adds it to the end of the list of 310 * curve segment objects of the curve and returns a reference to the 311 * newly created object. 312 */ public 313 CubicBezier createCubicBezier() { 314 long cPtr = libsbmlJNI.ReactionGlyph_createCubicBezier(swigCPtr, this); 315 return (cPtr == 0) ? null : new CubicBezier(cPtr, false); 316 } 317 318 319/** 320 * Remove the species reference glyph with the given index. 321 * A pointer to the object is returned. If no object has been removed, null 322 * is returned. 323 */ public 324 SpeciesReferenceGlyph removeSpeciesReferenceGlyph(long index) { 325 long cPtr = libsbmlJNI.ReactionGlyph_removeSpeciesReferenceGlyph__SWIG_0(swigCPtr, this, index); 326 return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, true); 327 } 328 329 330/** 331 * Remove the species reference glyph with the given <code>id</code>. 332 * A pointer to the object is returned. If no object has been removed, null 333 * is returned. 334 */ public 335 SpeciesReferenceGlyph removeSpeciesReferenceGlyph(String id) { 336 long cPtr = libsbmlJNI.ReactionGlyph_removeSpeciesReferenceGlyph__SWIG_1(swigCPtr, this, id); 337 return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, true); 338 } 339 340 341/** 342 * Returns the index of the species reference glyph with the given <code>id</code>. 343 * If the reaction glyph does not contain a species reference glyph with this 344 * id, the 345 * value of the maximum long integer is returned as an indicator. 346 */ public 347 long getIndexForSpeciesReferenceGlyph(String id) { 348 return libsbmlJNI.ReactionGlyph_getIndexForSpeciesReferenceGlyph(swigCPtr, this, id); 349 } 350 351 352/** 353 * Returns the XML element name of 354 * this SBML object. 355 */ public 356 String getElementName() { 357 return libsbmlJNI.ReactionGlyph_getElementName(swigCPtr, this); 358 } 359 360 361/** 362 * Creates and returns a deep copy of this {@link ReactionGlyph} object. 363 <p> 364 * @return a (deep) copy of this {@link ReactionGlyph}. 365 */ public 366 ReactionGlyph cloneObject() { 367 long cPtr = libsbmlJNI.ReactionGlyph_cloneObject(swigCPtr, this); 368 return (cPtr == 0) ? null : new ReactionGlyph(cPtr, true); 369 } 370 371 372/** 373 * Returns the libSBML type code of this object instance. 374 <p> 375 * <p> 376 * LibSBML attaches an identifying code to every kind of SBML object. These 377 * are integer constants known as <em>SBML type codes</em>. The names of all 378 * the codes begin with the characters “<code>SBML_</code>”. 379 * In the Java language interface for libSBML, the 380 * type codes are defined as static integer constants in the interface class 381 * {@link libsbmlConstants}. Note that different Level 3 382 * package plug-ins may use overlapping type codes; to identify the package 383 * to which a given object belongs, call the <code>getPackageName()</code> 384 * method on the object. 385 <p> 386 * @return the SBML type code for this object: 387 * {@link libsbmlConstants#SBML_LAYOUT_REACTIONGLYPH SBML_LAYOUT_REACTIONGLYPH} 388 <p> 389 * <p> 390 * @warning <span class='warning'>The specific integer values of the possible 391 * type codes may be reused by different Level 3 package plug-ins. 392 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 393 * both getTypeCode() and getPackageName()</strong>.</span> 394 <p> 395 * @see #getElementName() 396 * @see #getPackageName() 397 */ public 398 int getTypeCode() { 399 return libsbmlJNI.ReactionGlyph_getTypeCode(swigCPtr, this); 400 } 401 402 403/** 404 * Creates an {@link XMLNode} object from this. 405 */ public 406 XMLNode toXML() { 407 return new XMLNode(libsbmlJNI.ReactionGlyph_toXML(swigCPtr, this), true); 408 } 409 410 411/** 412 * Sets this SBML object to child SBML objects (if any). 413 * (Creates a child-parent relationship by the parent) 414 <p> 415 * Subclasses must override this function if they define 416 * one ore more child elements. 417 * Basically, this function needs to be called in 418 * constructor, copy constructor, assignment operator. 419 <p> 420 * @see setSBMLDocument 421 * @see enablePackageInternal 422 * @internal 423 */ public 424 void connectToChild() { 425 libsbmlJNI.ReactionGlyph_connectToChild(swigCPtr, this); 426 } 427 428 429/** 430 * Enables/Disables the given package with this element and child 431 * elements (if any). 432 * (This is an internal implementation for enablePakcage function) 433 <p> 434 * @note Subclasses in which one or more child elements are defined 435 * must override this function. 436 * @internal 437 */ public 438 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 439 libsbmlJNI.ReactionGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 440 } 441 442}