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 GeneralGlyph is used by the “layout” 015 * package to represent any SBML object. 016 <p> 017 * The {@link GeneralGlyph} is used to facilitate the representation of elements 018 * other than {@link Compartment}, {@link Species} and {@link Reaction} and thus can be used for the 019 * display of relationships of {@link Rule} or elements defined by other SBML 020 * packages. It closely follows the structure of the {@link ReactionGlyph}. 021 * {@link GeneralGlyph} is defined to have an optional attribute reference as well as 022 * the elements curve, listOfReferenceGlyphs and listOfSubGlyphs. 023 */ 024 025public class GeneralGlyph extends GraphicalObject { 026 private long swigCPtr; 027 028 protected GeneralGlyph(long cPtr, boolean cMemoryOwn) 029 { 030 super(libsbmlJNI.GeneralGlyph_SWIGUpcast(cPtr), cMemoryOwn); 031 swigCPtr = cPtr; 032 } 033 034 protected static long getCPtr(GeneralGlyph obj) 035 { 036 return (obj == null) ? 0 : obj.swigCPtr; 037 } 038 039 protected static long getCPtrAndDisown (GeneralGlyph obj) 040 { 041 long ptr = 0; 042 043 if (obj != null) 044 { 045 ptr = obj.swigCPtr; 046 obj.swigCMemOwn = false; 047 } 048 049 return ptr; 050 } 051 052 protected void finalize() { 053 delete(); 054 } 055 056 public synchronized void delete() { 057 if (swigCPtr != 0) { 058 if (swigCMemOwn) { 059 swigCMemOwn = false; 060 libsbmlJNI.delete_GeneralGlyph(swigCPtr); 061 } 062 swigCPtr = 0; 063 } 064 super.delete(); 065 } 066 067 068/** 069 * Creates a new {@link GeneralGlyph}. The list of reference glyph and subglyphs is 070 * empty and the id of the associated element is set to the empty 071 * string. 072 */ public 073 GeneralGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 074 this(libsbmlJNI.new_GeneralGlyph__SWIG_0(level, version, pkgVersion), true); 075 } 076 077 078/** 079 * Creates a new {@link GeneralGlyph}. The list of reference glyph and subglyphs is 080 * empty and the id of the associated element is set to the empty 081 * string. 082 */ public 083 GeneralGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 084 this(libsbmlJNI.new_GeneralGlyph__SWIG_1(level, version), true); 085 } 086 087 088/** 089 * Creates a new {@link GeneralGlyph}. The list of reference glyph and subglyphs is 090 * empty and the id of the associated element is set to the empty 091 * string. 092 */ public 093 GeneralGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException { 094 this(libsbmlJNI.new_GeneralGlyph__SWIG_2(level), true); 095 } 096 097 098/** 099 * Creates a new {@link GeneralGlyph}. The list of reference glyph and subglyphs is 100 * empty and the id of the associated element is set to the empty 101 * string. 102 */ public 103 GeneralGlyph() throws org.sbml.libsbml.SBMLConstructorException { 104 this(libsbmlJNI.new_GeneralGlyph__SWIG_3(), true); 105 } 106 107 108/** 109 * Creates a new {@link GeneralGlyph} with the given {@link LayoutPkgNamespaces} object. 110 */ public 111 GeneralGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 112 this(libsbmlJNI.new_GeneralGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 113 } 114 115 116/** 117 * Creates a glyph with the given {@link LayoutPkgNamespaces} and id. 118 <p> 119 * (FOR BACKWARD COMPATIBILITY) 120 */ public 121 GeneralGlyph(LayoutPkgNamespaces layoutns, String id) throws org.sbml.libsbml.SBMLConstructorException { 122 this(libsbmlJNI.new_GeneralGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id), true); 123 } 124 125 126/** 127 * Creates a glyph with the given {@link LayoutPkgNamespaces}, id and set the id of the 128 * associated element to the second argument. 129 <p> 130 * (FOR BACKWARD COMPATIBILITY) 131 */ public 132 GeneralGlyph(LayoutPkgNamespaces layoutns, String id, String referenceId) throws org.sbml.libsbml.SBMLConstructorException { 133 this(libsbmlJNI.new_GeneralGlyph__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, referenceId), true); 134 } 135 136 137/** 138 * Creates a new {@link GeneralGlyph} from the given {@link XMLNode} 139 <p> 140 * (FOR BACKWARD COMPATIBILITY) 141 */ public 142 GeneralGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 143 this(libsbmlJNI.new_GeneralGlyph__SWIG_7(XMLNode.getCPtr(node), node, l2version), true); 144 } 145 146 147/** 148 * Creates a new {@link GeneralGlyph} from the given {@link XMLNode} 149 <p> 150 * (FOR BACKWARD COMPATIBILITY) 151 */ public 152 GeneralGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 153 this(libsbmlJNI.new_GeneralGlyph__SWIG_8(XMLNode.getCPtr(node), node), true); 154 } 155 156 157/** 158 * Copy constructor. 159 */ public 160 GeneralGlyph(GeneralGlyph source) throws org.sbml.libsbml.SBMLConstructorException { 161 this(libsbmlJNI.new_GeneralGlyph__SWIG_9(GeneralGlyph.getCPtr(source), source), true); 162 } 163 164 165/** 166 * Renames all the <code>SIdRef</code> attributes on this element, including any 167 * found in MathML content (if such exists). 168 <p> 169 * This method works by looking at all attributes and (if appropriate) 170 * mathematical formulas, comparing the identifiers to the value of 171 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 172 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 173 <p> 174 * @param oldid the old identifier 175 * @param newid the new identifier 176 */ public 177 void renameSIdRefs(String oldid, String newid) { 178 libsbmlJNI.GeneralGlyph_renameSIdRefs(swigCPtr, this, oldid, newid); 179 } 180 181 182/** 183 * Returns the id of the associated element. 184 */ public 185 String getReferenceId() { 186 return libsbmlJNI.GeneralGlyph_getReferenceId(swigCPtr, this); 187 } 188 189 190/** 191 * Sets the id of the associated element. 192 */ public 193 int setReferenceId(String id) { 194 return libsbmlJNI.GeneralGlyph_setReferenceId(swigCPtr, this, id); 195 } 196 197 198/** 199 * Returns true if the id of the associated element is not the empty 200 * string. 201 */ public 202 boolean isSetReferenceId() { 203 return libsbmlJNI.GeneralGlyph_isSetReferenceId(swigCPtr, this); 204 } 205 206 207/** 208 * Returns the {@link ListOf} object that hold the reference glyphs. 209 */ public 210 ListOfReferenceGlyphs getListOfReferenceGlyphs() { 211 long cPtr = libsbmlJNI.GeneralGlyph_getListOfReferenceGlyphs__SWIG_0(swigCPtr, this); 212 return (cPtr == 0) ? null : new ListOfReferenceGlyphs(cPtr, false); 213 } 214 215 216/** 217 * Returns the {@link ListOf} object that hold the sub glyphs. 218 */ public 219 ListOfGraphicalObjects getListOfSubGlyphs() { 220 long cPtr = libsbmlJNI.GeneralGlyph_getListOfSubGlyphs__SWIG_0(swigCPtr, this); 221 return (cPtr == 0) ? null : new ListOfGraphicalObjects(cPtr, false); 222 } 223 224 225/** 226 * Returns the reference glyph with the given index. 227 * If the index is invalid, <code>null</code> is returned. 228 */ public 229 ReferenceGlyph getReferenceGlyph(long index) { 230 long cPtr = libsbmlJNI.GeneralGlyph_getReferenceGlyph__SWIG_0(swigCPtr, this, index); 231 return (cPtr == 0) ? null : new ReferenceGlyph(cPtr, false); 232 } 233 234 235/** 236 * Returns the sub glyph with the given index. 237 * If the index is invalid, <code>null</code> is returned. 238 */ public 239 GraphicalObject getSubGlyph(long index) { 240 return (GraphicalObject) libsbml.DowncastSBase(libsbmlJNI.GeneralGlyph_getSubGlyph__SWIG_0(swigCPtr, this, index), false); 241} 242 243 244/** 245 * Adds a new reference glyph to the list. 246 */ public 247 void addReferenceGlyph(ReferenceGlyph glyph) { 248 libsbmlJNI.GeneralGlyph_addReferenceGlyph(swigCPtr, this, ReferenceGlyph.getCPtr(glyph), glyph); 249 } 250 251 252/** 253 * Adds a new subglyph to the list. 254 */ public 255 void addSubGlyph(GraphicalObject glyph) { 256 libsbmlJNI.GeneralGlyph_addSubGlyph(swigCPtr, this, GraphicalObject.getCPtr(glyph), glyph); 257 } 258 259 260/** 261 * Returns the number of reference glyph objects. 262 */ public 263 long getNumReferenceGlyphs() { 264 return libsbmlJNI.GeneralGlyph_getNumReferenceGlyphs(swigCPtr, this); 265 } 266 267 268/** 269 * Returns the number of subglyph objects. 270 */ public 271 long getNumSubGlyphs() { 272 return libsbmlJNI.GeneralGlyph_getNumSubGlyphs(swigCPtr, this); 273 } 274 275 276/** 277 * Calls initDefaults from {@link GraphicalObject}. 278 */ public 279 void initDefaults() { 280 libsbmlJNI.GeneralGlyph_initDefaults(swigCPtr, this); 281 } 282 283 284/** 285 * Returns the curve object for the reaction glyph 286 */ public 287 Curve getCurve() { 288 long cPtr = libsbmlJNI.GeneralGlyph_getCurve__SWIG_0(swigCPtr, this); 289 return (cPtr == 0) ? null : new Curve(cPtr, false); 290 } 291 292 293/** 294 * Sets the curve object for the reaction glyph. 295 */ public 296 void setCurve(Curve curve) { 297 libsbmlJNI.GeneralGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve); 298 } 299 300 301/** 302 * Returns true if the curve consists of one or more segments. 303 */ public 304 boolean isSetCurve() { 305 return libsbmlJNI.GeneralGlyph_isSetCurve(swigCPtr, this); 306 } 307 308 309/** */ public 310 boolean getCurveExplicitlySet() { 311 return libsbmlJNI.GeneralGlyph_getCurveExplicitlySet(swigCPtr, this); 312 } 313 314 315/** 316 * Creates a new {@link ReferenceGlyph} object, adds it to the end of the 317 * list of reference objects and returns a reference to the newly 318 * created object. 319 */ public 320 ReferenceGlyph createReferenceGlyph() { 321 long cPtr = libsbmlJNI.GeneralGlyph_createReferenceGlyph(swigCPtr, this); 322 return (cPtr == 0) ? null : new ReferenceGlyph(cPtr, false); 323 } 324 325 326/** 327 * Creates a new {@link LineSegment} object, adds it to the end of the list of 328 * curve segment objects of the curve and returns a reference to the 329 * newly created object. 330 */ public 331 LineSegment createLineSegment() { 332 return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.GeneralGlyph_createLineSegment(swigCPtr, this), false); 333} 334 335 336/** 337 * Creates a new {@link CubicBezier} object, adds it to the end of the list of 338 * curve segment objects of the curve and returns a reference to the 339 * newly created object. 340 */ public 341 CubicBezier createCubicBezier() { 342 long cPtr = libsbmlJNI.GeneralGlyph_createCubicBezier(swigCPtr, this); 343 return (cPtr == 0) ? null : new CubicBezier(cPtr, false); 344 } 345 346 347/** 348 * Remove the reference glyph with the given index. 349 * A pointer to the object is returned. If no object has been removed, null 350 * is returned. 351 */ public 352 ReferenceGlyph removeReferenceGlyph(long index) { 353 long cPtr = libsbmlJNI.GeneralGlyph_removeReferenceGlyph__SWIG_0(swigCPtr, this, index); 354 return (cPtr == 0) ? null : new ReferenceGlyph(cPtr, false); 355 } 356 357 358/** 359 * Remove the subglyph with the given index. 360 * A pointer to the object is returned. If no object has been removed, null 361 * is returned. 362 */ public 363 GraphicalObject removeSubGlyph(long index) { 364 return (GraphicalObject) libsbml.DowncastSBase(libsbmlJNI.GeneralGlyph_removeSubGlyph__SWIG_0(swigCPtr, this, index), false); 365} 366 367 368/** 369 * Remove the reference glyph with the given <code>id</code>. 370 * A pointer to the object is returned. If no object has been removed, null 371 * is returned. 372 */ public 373 ReferenceGlyph removeReferenceGlyph(String id) { 374 long cPtr = libsbmlJNI.GeneralGlyph_removeReferenceGlyph__SWIG_1(swigCPtr, this, id); 375 return (cPtr == 0) ? null : new ReferenceGlyph(cPtr, false); 376 } 377 378 379/** 380 * Remove the subglyph with the given <code>id</code>. 381 * A pointer to the object is returned. If no object has been removed, null 382 * is returned. 383 */ public 384 GraphicalObject removeSubGlyph(String id) { 385 return (GraphicalObject) libsbml.DowncastSBase(libsbmlJNI.GeneralGlyph_removeSubGlyph__SWIG_1(swigCPtr, this, id), false); 386} 387 388 389/** 390 * Returns the index of the reference glyph with the given <code>id</code>. 391 * If the glyph does not contain a reference glyph with this 392 * id, the 393 * value of the maximum long integer is returned as an indicator. 394 */ public 395 long getIndexForReferenceGlyph(String id) { 396 return libsbmlJNI.GeneralGlyph_getIndexForReferenceGlyph(swigCPtr, this, id); 397 } 398 399 400/** 401 * Returns the index of the subglyph with the given <code>id</code>. 402 * If the glyph does not contain a subglyph with this 403 * id, the 404 * value of the maximum long integer is returned as an indicator. 405 */ public 406 long getIndexForSubGlyph(String id) { 407 return libsbmlJNI.GeneralGlyph_getIndexForSubGlyph(swigCPtr, this, id); 408 } 409 410 411/** 412 * Returns the XML element name of 413 * this SBML object. 414 */ public 415 String getElementName() { 416 return libsbmlJNI.GeneralGlyph_getElementName(swigCPtr, this); 417 } 418 419 420/** 421 * Creates and returns a deep copy of this {@link GeneralGlyph}. 422 <p> 423 * @return a (deep) copy of this {@link GeneralGlyph}. 424 */ public 425 GeneralGlyph cloneObject() { 426 long cPtr = libsbmlJNI.GeneralGlyph_cloneObject(swigCPtr, this); 427 return (cPtr == 0) ? null : new GeneralGlyph(cPtr, true); 428 } 429 430 431/** 432 * Returns the libSBML type code of this object instance. 433 <p> 434 * <p> 435 * LibSBML attaches an identifying code to every kind of SBML object. These 436 * are integer constants known as <em>SBML type codes</em>. The names of all 437 * the codes begin with the characters “<code>SBML_</code>”. 438 * In the Java language interface for libSBML, the 439 * type codes are defined as static integer constants in the interface class 440 * {@link libsbmlConstants}. Note that different Level 3 441 * package plug-ins may use overlapping type codes; to identify the package 442 * to which a given object belongs, call the <code>getPackageName()</code> 443 * method on the object. 444 <p> 445 * @return the SBML type code for this object: 446 * {@link libsbmlConstants#SBML_LAYOUT_GENERALGLYPH SBML_LAYOUT_GENERALGLYPH} 447 <p> 448 * <p> 449 * @warning <span class='warning'>The specific integer values of the possible 450 * type codes may be reused by different Level 3 package plug-ins. 451 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 452 * both getTypeCode() and getPackageName()</strong>.</span> 453 <p> 454 * @see #getElementName() 455 * @see #getPackageName() 456 */ public 457 int getTypeCode() { 458 return libsbmlJNI.GeneralGlyph_getTypeCode(swigCPtr, this); 459 } 460 461 462/** 463 * Creates an {@link XMLNode} object from this. 464 */ public 465 XMLNode toXML() { 466 return new XMLNode(libsbmlJNI.GeneralGlyph_toXML(swigCPtr, this), true); 467 } 468 469 470/** 471 * Sets this SBML object to child SBML objects (if any). 472 * (Creates a child-parent relationship by the parent) 473 <p> 474 * Subclasses must override this function if they define 475 * one ore more child elements. 476 * Basically, this function needs to be called in 477 * constructor, copy constructor, assignment operator. 478 <p> 479 * @see setSBMLDocument 480 * @see enablePackageInternal 481 * @internal 482 */ public 483 void connectToChild() { 484 libsbmlJNI.GeneralGlyph_connectToChild(swigCPtr, this); 485 } 486 487 488/** 489 * Enables/Disables the given package with this element and child 490 * elements (if any). 491 * (This is an internal implementation for enablePakcage function) 492 <p> 493 * @note Subclasses in which one or more child elements are defined 494 * must override this function. 495 * @internal 496 */ public 497 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 498 libsbmlJNI.GeneralGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 499 } 500 501}