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 ReferenceGlyph is used by the “layout” 015 * package to connect a {@link GraphicalObject} and a {@link GeneralGlyph}. 016 <p> 017 * The {@link ReferenceGlyph} element describes the graphical connection between an 018 * arbitrary {@link GraphicalObject} (or derived element) and a {@link GeneralGlyph} (which 019 * would be an arrow or some curve in most cases). A {@link ReferenceGlyph} inherits 020 * from {@link GraphicalObject}. Additionally it has a mandatory attribute 'glyph' 021 * and two optional attributes 'reference' and 'role'. Optionally, the 022 * {@link ReferenceGlyph} also has an element 'curve'. The {@link ReferenceGlyph} should 023 * either contain a bounding box or a curve specification. If both are 024 * given, the bounding box should be ignored. 025 */ 026 027public class ReferenceGlyph extends GraphicalObject { 028 private long swigCPtr; 029 030 protected ReferenceGlyph(long cPtr, boolean cMemoryOwn) 031 { 032 super(libsbmlJNI.ReferenceGlyph_SWIGUpcast(cPtr), cMemoryOwn); 033 swigCPtr = cPtr; 034 } 035 036 protected static long getCPtr(ReferenceGlyph obj) 037 { 038 return (obj == null) ? 0 : obj.swigCPtr; 039 } 040 041 protected static long getCPtrAndDisown (ReferenceGlyph obj) 042 { 043 long ptr = 0; 044 045 if (obj != null) 046 { 047 ptr = obj.swigCPtr; 048 obj.swigCMemOwn = false; 049 } 050 051 return ptr; 052 } 053 054 protected void finalize() { 055 delete(); 056 } 057 058 public synchronized void delete() { 059 if (swigCPtr != 0) { 060 if (swigCMemOwn) { 061 swigCMemOwn = false; 062 libsbmlJNI.delete_ReferenceGlyph(swigCPtr); 063 } 064 swigCPtr = 0; 065 } 066 super.delete(); 067 } 068 069 070/** 071 * Creates a new {@link ReferenceGlyph} with the given SBML level, version and 072 * package version. The id if the associated 073 * reference and the id of the associated glyph are set to the 074 * empty string. The role is set to empty. 075 */ public 076 ReferenceGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 077 this(libsbmlJNI.new_ReferenceGlyph__SWIG_0(level, version, pkgVersion), true); 078 } 079 080 081/** 082 * Creates a new {@link ReferenceGlyph} with the given SBML level, version and 083 * package version. The id if the associated 084 * reference and the id of the associated glyph are set to the 085 * empty string. The role is set to empty. 086 */ public 087 ReferenceGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 088 this(libsbmlJNI.new_ReferenceGlyph__SWIG_1(level, version), true); 089 } 090 091 092/** 093 * Creates a new {@link ReferenceGlyph} with the given SBML level, version and 094 * package version. The id if the associated 095 * reference and the id of the associated glyph are set to the 096 * empty string. The role is set to empty. 097 */ public 098 ReferenceGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException { 099 this(libsbmlJNI.new_ReferenceGlyph__SWIG_2(level), true); 100 } 101 102 103/** 104 * Creates a new {@link ReferenceGlyph} with the given SBML level, version and 105 * package version. The id if the associated 106 * reference and the id of the associated glyph are set to the 107 * empty string. The role is set to empty. 108 */ public 109 ReferenceGlyph() throws org.sbml.libsbml.SBMLConstructorException { 110 this(libsbmlJNI.new_ReferenceGlyph__SWIG_3(), true); 111 } 112 113 114/** 115 * Ctor. 116 */ public 117 ReferenceGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 118 this(libsbmlJNI.new_ReferenceGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 119 } 120 121 122/** 123 * Creates a new {@link ReferenceGlyph}. The id is given as the first 124 * argument, the id of the associated glyph is given as the 125 * second argument. The third argument is the id of the associated 126 * reference and the fourth argument is the role. 127 */ public 128 ReferenceGlyph(LayoutPkgNamespaces layoutns, String sid, String glyphId, String referenceId, String role) throws org.sbml.libsbml.SBMLConstructorException { 129 this(libsbmlJNI.new_ReferenceGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, sid, glyphId, referenceId, role), true); 130 } 131 132 133/** 134 * Creates a new {@link ReferenceGlyph} from the given {@link XMLNode} 135 */ public 136 ReferenceGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 137 this(libsbmlJNI.new_ReferenceGlyph__SWIG_6(XMLNode.getCPtr(node), node, l2version), true); 138 } 139 140 141/** 142 * Creates a new {@link ReferenceGlyph} from the given {@link XMLNode} 143 */ public 144 ReferenceGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 145 this(libsbmlJNI.new_ReferenceGlyph__SWIG_7(XMLNode.getCPtr(node), node), true); 146 } 147 148 149/** 150 * Copy constructor. 151 */ public 152 ReferenceGlyph(ReferenceGlyph source) throws org.sbml.libsbml.SBMLConstructorException { 153 this(libsbmlJNI.new_ReferenceGlyph__SWIG_8(ReferenceGlyph.getCPtr(source), source), true); 154 } 155 156 157/** 158 * Renames all the <code>SIdRef</code> attributes on this element, including any 159 * found in MathML content (if such exists). 160 <p> 161 * This method works by looking at all attributes and (if appropriate) 162 * mathematical formulas, comparing the identifiers to the value of 163 * <code>oldid</code>. If any matches are found, the matching identifiers are replaced 164 * with <code>newid</code>. The method does <em>not</em> descend into child elements. 165 <p> 166 * @param oldid the old identifier 167 * @param newid the new identifier 168 */ public 169 void renameSIdRefs(String oldid, String newid) { 170 libsbmlJNI.ReferenceGlyph_renameSIdRefs(swigCPtr, this, oldid, newid); 171 } 172 173 174/** 175 * Returns the id of the associated glyph. 176 */ public 177 String getGlyphId() { 178 return libsbmlJNI.ReferenceGlyph_getGlyphId(swigCPtr, this); 179 } 180 181 182/** 183 * Sets the id of the associated glyph. 184 */ public 185 void setGlyphId(String glyphId) { 186 libsbmlJNI.ReferenceGlyph_setGlyphId(swigCPtr, this, glyphId); 187 } 188 189 190/** 191 * Returns the id of the associated sbml reference. 192 */ public 193 String getReferenceId() { 194 return libsbmlJNI.ReferenceGlyph_getReferenceId(swigCPtr, this); 195 } 196 197 198/** 199 * Sets the id of the associated sbml reference. 200 */ public 201 void setReferenceId(String id) { 202 libsbmlJNI.ReferenceGlyph_setReferenceId(swigCPtr, this, id); 203 } 204 205 206/** 207 * Returns a string representation of the role. 208 */ public 209 String getRole() { 210 return libsbmlJNI.ReferenceGlyph_getRole(swigCPtr, this); 211 } 212 213 214/** 215 * Sets the role. 216 */ public 217 void setRole(String role) { 218 libsbmlJNI.ReferenceGlyph_setRole(swigCPtr, this, role); 219 } 220 221 222/** 223 * Returns the curve object for the reference glyph 224 */ public 225 Curve getCurve() { 226 long cPtr = libsbmlJNI.ReferenceGlyph_getCurve__SWIG_0(swigCPtr, this); 227 return (cPtr == 0) ? null : new Curve(cPtr, false); 228 } 229 230 231/** 232 * Sets the curve object for the reference glyph. 233 */ public 234 void setCurve(Curve curve) { 235 libsbmlJNI.ReferenceGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve); 236 } 237 238 239/** 240 * Returns true if the curve consists of one or more segments. 241 */ public 242 boolean isSetCurve() { 243 return libsbmlJNI.ReferenceGlyph_isSetCurve(swigCPtr, this); 244 } 245 246 247/** */ public 248 boolean getCurveExplicitlySet() { 249 return libsbmlJNI.ReferenceGlyph_getCurveExplicitlySet(swigCPtr, this); 250 } 251 252 253/** 254 * Returns true if the id of the associated glyph is not the 255 * empty string. 256 */ public 257 boolean isSetGlyphId() { 258 return libsbmlJNI.ReferenceGlyph_isSetGlyphId(swigCPtr, this); 259 } 260 261 262/** 263 * Returns true if the id of the associated reference is not the 264 * empty string. 265 */ public 266 boolean isSetReferenceId() { 267 return libsbmlJNI.ReferenceGlyph_isSetReferenceId(swigCPtr, this); 268 } 269 270 271/** 272 * Returns true of role is different from the empty string. 273 */ public 274 boolean isSetRole() { 275 return libsbmlJNI.ReferenceGlyph_isSetRole(swigCPtr, this); 276 } 277 278 279/** 280 * Calls initDefaults on {@link GraphicalObject} 281 */ public 282 void initDefaults() { 283 libsbmlJNI.ReferenceGlyph_initDefaults(swigCPtr, this); 284 } 285 286 287/** 288 * Creates a new {@link LineSegment} object, adds it to the end of the list of 289 * curve segment objects of the curve and returns a reference to the 290 * newly created object. 291 */ public 292 LineSegment createLineSegment() { 293 return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.ReferenceGlyph_createLineSegment(swigCPtr, this), false); 294} 295 296 297/** 298 * Creates a new {@link CubicBezier} object, adds it to the end of the list of 299 * curve segment objects of the curve and returns a reference to the 300 * newly created object. 301 */ public 302 CubicBezier createCubicBezier() { 303 long cPtr = libsbmlJNI.ReferenceGlyph_createCubicBezier(swigCPtr, this); 304 return (cPtr == 0) ? null : new CubicBezier(cPtr, false); 305 } 306 307 308/** 309 * Returns the XML element name of 310 * this SBML object. 311 */ public 312 String getElementName() { 313 return libsbmlJNI.ReferenceGlyph_getElementName(swigCPtr, this); 314 } 315 316 317/** 318 * Creates and returns a deep copy of this {@link ReferenceGlyph}. 319 <p> 320 * @return a (deep) copy of this {@link ReferenceGlyph}. 321 */ public 322 ReferenceGlyph cloneObject() { 323 long cPtr = libsbmlJNI.ReferenceGlyph_cloneObject(swigCPtr, this); 324 return (cPtr == 0) ? null : new ReferenceGlyph(cPtr, true); 325 } 326 327 328/** 329 * Returns the libSBML type code of this object instance. 330 <p> 331 * <p> 332 * LibSBML attaches an identifying code to every kind of SBML object. These 333 * are integer constants known as <em>SBML type codes</em>. The names of all 334 * the codes begin with the characters “<code>SBML_</code>”. 335 * In the Java language interface for libSBML, the 336 * type codes are defined as static integer constants in the interface class 337 * {@link libsbmlConstants}. Note that different Level 3 338 * package plug-ins may use overlapping type codes; to identify the package 339 * to which a given object belongs, call the <code>getPackageName()</code> 340 * method on the object. 341 <p> 342 * @return the SBML type code for this object: 343 * {@link libsbmlConstants#SBML_LAYOUT_REFERENCEGLYPH SBML_LAYOUT_REFERENCEGLYPH} 344 <p> 345 * <p> 346 * @warning <span class='warning'>The specific integer values of the possible 347 * type codes may be reused by different Level 3 package plug-ins. 348 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 349 * both getTypeCode() and getPackageName()</strong>.</span> 350 <p> 351 * @see #getElementName() 352 * @see #getPackageName() 353 */ public 354 int getTypeCode() { 355 return libsbmlJNI.ReferenceGlyph_getTypeCode(swigCPtr, this); 356 } 357 358 359/** 360 * Creates an {@link XMLNode} object from this. 361 */ public 362 XMLNode toXML() { 363 return new XMLNode(libsbmlJNI.ReferenceGlyph_toXML(swigCPtr, this), true); 364 } 365 366 367/** 368 * Sets this SBML object to child SBML objects (if any). 369 * (Creates a child-parent relationship by the parent) 370 <p> 371 * Subclasses must override this function if they define 372 * one ore more child elements. 373 * Basically, this function needs to be called in 374 * constructor, copy constructor, assignment operator. 375 <p> 376 * @see setSBMLDocument 377 * @see enablePackageInternal 378 * @internal 379 */ public 380 void connectToChild() { 381 libsbmlJNI.ReferenceGlyph_connectToChild(swigCPtr, this); 382 } 383 384 385/** 386 * Enables/Disables the given package with this element and child 387 * elements (if any). 388 * (This is an internal implementation for enablePakcage function) 389 <p> 390 * @note Subclasses in which one or more child elements are defined 391 * must override this function. 392 * @internal 393 */ public 394 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 395 libsbmlJNI.ReferenceGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 396 } 397 398}