001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.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 Connection between an object and a glyph.
015 <p>
016 * The {@link ReferenceGlyph} element describes the graphical connection between an
017 * arbitrary {@link GraphicalObject} (or derived element) and a {@link GeneralGlyph} (which
018 * would be an arrow or some curve in most cases). A {@link ReferenceGlyph} inherits
019 * from {@link GraphicalObject}. Additionally it has a mandatory attribute 'glyph'
020 * and two optional attributes 'reference' and 'role'. Optionally, the
021 * {@link ReferenceGlyph} also has an element 'curve'.  The {@link ReferenceGlyph} should
022 * either contain a bounding box or a curve specification.  If both are
023 * given, the bounding box should be ignored.
024 */
025
026public class ReferenceGlyph extends GraphicalObject {
027   private long swigCPtr;
028
029   protected ReferenceGlyph(long cPtr, boolean cMemoryOwn)
030   {
031     super(libsbmlJNI.ReferenceGlyph_SWIGUpcast(cPtr), cMemoryOwn);
032     swigCPtr = cPtr;
033   }
034
035   protected static long getCPtr(ReferenceGlyph obj)
036   {
037     return (obj == null) ? 0 : obj.swigCPtr;
038   }
039
040   protected static long getCPtrAndDisown (ReferenceGlyph obj)
041   {
042     long ptr = 0;
043
044     if (obj != null)
045     {
046       ptr             = obj.swigCPtr;
047       obj.swigCMemOwn = false;
048     }
049
050     return ptr;
051   }
052
053  protected void finalize() {
054    delete();
055  }
056
057  public synchronized void delete() {
058    if (swigCPtr != 0) {
059      if (swigCMemOwn) {
060        swigCMemOwn = false;
061        libsbmlJNI.delete_ReferenceGlyph(swigCPtr);
062      }
063      swigCPtr = 0;
064    }
065    super.delete();
066  }
067
068  
069/**
070   * Creates a new {@link ReferenceGlyph} with the given SBML level, version and
071   * package version.  The id if the associated 
072   * reference and the id of the associated  glyph are set to the
073   * empty string.  The role is set to empty.
074   <p>
075   * @param level the SBML Level.
076   * @param version the Version within the SBML Level.
077   * @param pkgVersion the version of the package.
078   <p>
079   * <p>
080 * @note Attempting to add an object to an {@link SBMLDocument} having a different
081 * combination of SBML Level, Version and XML namespaces than the object
082 * itself will result in an error at the time a caller attempts to make the
083 * addition.  A parent object must have compatible Level, Version and XML
084 * namespaces.  (Strictly speaking, a parent may also have more XML
085 * namespaces than a child, but the reverse is not permitted.)  The
086 * restriction is necessary to ensure that an SBML model has a consistent
087 * overall structure.  This requires callers to manage their objects
088 * carefully, but the benefit is increased flexibility in how models can be
089 * created by permitting callers to create objects bottom-up if desired.  In
090 * situations where objects are not yet attached to parents (e.g.,
091 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
092 * libSBML determine such things as whether it is valid to assign a
093 * particular value to an attribute.  For packages, this means that the 
094 * parent object to which this package element is being added must have
095 * been created with the package namespace, or that the package namespace
096 * was added to it, even if that parent is not a package object itself.
097   */ public
098 ReferenceGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
099    this(libsbmlJNI.new_ReferenceGlyph__SWIG_0(level, version, pkgVersion), 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   <p>
109   * @param level the SBML Level.
110   * @param version the Version within the SBML Level.
111   * @param pkgVersion the version of the package.
112   <p>
113   * <p>
114 * @note Attempting to add an object to an {@link SBMLDocument} having a different
115 * combination of SBML Level, Version and XML namespaces than the object
116 * itself will result in an error at the time a caller attempts to make the
117 * addition.  A parent object must have compatible Level, Version and XML
118 * namespaces.  (Strictly speaking, a parent may also have more XML
119 * namespaces than a child, but the reverse is not permitted.)  The
120 * restriction is necessary to ensure that an SBML model has a consistent
121 * overall structure.  This requires callers to manage their objects
122 * carefully, but the benefit is increased flexibility in how models can be
123 * created by permitting callers to create objects bottom-up if desired.  In
124 * situations where objects are not yet attached to parents (e.g.,
125 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
126 * libSBML determine such things as whether it is valid to assign a
127 * particular value to an attribute.  For packages, this means that the 
128 * parent object to which this package element is being added must have
129 * been created with the package namespace, or that the package namespace
130 * was added to it, even if that parent is not a package object itself.
131   */ public
132 ReferenceGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
133    this(libsbmlJNI.new_ReferenceGlyph__SWIG_1(level, version), true);
134  }
135
136  
137/**
138   * Creates a new {@link ReferenceGlyph} with the given SBML level, version and
139   * package version.  The id if the associated 
140   * reference and the id of the associated  glyph are set to the
141   * empty string.  The role is set to empty.
142   <p>
143   * @param level the SBML Level.
144   * @param version the Version within the SBML Level.
145   * @param pkgVersion the version of the package.
146   <p>
147   * <p>
148 * @note Attempting to add an object to an {@link SBMLDocument} having a different
149 * combination of SBML Level, Version and XML namespaces than the object
150 * itself will result in an error at the time a caller attempts to make the
151 * addition.  A parent object must have compatible Level, Version and XML
152 * namespaces.  (Strictly speaking, a parent may also have more XML
153 * namespaces than a child, but the reverse is not permitted.)  The
154 * restriction is necessary to ensure that an SBML model has a consistent
155 * overall structure.  This requires callers to manage their objects
156 * carefully, but the benefit is increased flexibility in how models can be
157 * created by permitting callers to create objects bottom-up if desired.  In
158 * situations where objects are not yet attached to parents (e.g.,
159 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
160 * libSBML determine such things as whether it is valid to assign a
161 * particular value to an attribute.  For packages, this means that the 
162 * parent object to which this package element is being added must have
163 * been created with the package namespace, or that the package namespace
164 * was added to it, even if that parent is not a package object itself.
165   */ public
166 ReferenceGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException {
167    this(libsbmlJNI.new_ReferenceGlyph__SWIG_2(level), true);
168  }
169
170  
171/**
172   * Creates a new {@link ReferenceGlyph} with the given SBML level, version and
173   * package version.  The id if the associated 
174   * reference and the id of the associated  glyph are set to the
175   * empty string.  The role is set to empty.
176   <p>
177   * @param level the SBML Level.
178   * @param version the Version within the SBML Level.
179   * @param pkgVersion the version of the package.
180   <p>
181   * <p>
182 * @note Attempting to add an object to an {@link SBMLDocument} having a different
183 * combination of SBML Level, Version and XML namespaces than the object
184 * itself will result in an error at the time a caller attempts to make the
185 * addition.  A parent object must have compatible Level, Version and XML
186 * namespaces.  (Strictly speaking, a parent may also have more XML
187 * namespaces than a child, but the reverse is not permitted.)  The
188 * restriction is necessary to ensure that an SBML model has a consistent
189 * overall structure.  This requires callers to manage their objects
190 * carefully, but the benefit is increased flexibility in how models can be
191 * created by permitting callers to create objects bottom-up if desired.  In
192 * situations where objects are not yet attached to parents (e.g.,
193 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
194 * libSBML determine such things as whether it is valid to assign a
195 * particular value to an attribute.  For packages, this means that the 
196 * parent object to which this package element is being added must have
197 * been created with the package namespace, or that the package namespace
198 * was added to it, even if that parent is not a package object itself.
199   */ public
200 ReferenceGlyph() throws org.sbml.libsbml.SBMLConstructorException {
201    this(libsbmlJNI.new_ReferenceGlyph__SWIG_3(), true);
202  }
203
204  
205/**
206   * Constructor.
207   <p>
208   * <p>
209 * The package namespaces object used in this constructor is derived from a
210 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
211 * information.  It is used to communicate the SBML Level, Version, and 
212 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
213 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
214 * package namespace object somewhere in a program once, then hand that object
215 * as needed to object constructors of that package that accept it as and
216 * argument, such as this one.
217   <p>
218   * @param layoutns the {@link LayoutPkgNamespaces} object.
219   <p>
220   * <p>
221 * @note Attempting to add an object to an {@link SBMLDocument} having a different
222 * combination of SBML Level, Version and XML namespaces than the object
223 * itself will result in an error at the time a caller attempts to make the
224 * addition.  A parent object must have compatible Level, Version and XML
225 * namespaces.  (Strictly speaking, a parent may also have more XML
226 * namespaces than a child, but the reverse is not permitted.)  The
227 * restriction is necessary to ensure that an SBML model has a consistent
228 * overall structure.  This requires callers to manage their objects
229 * carefully, but the benefit is increased flexibility in how models can be
230 * created by permitting callers to create objects bottom-up if desired.  In
231 * situations where objects are not yet attached to parents (e.g.,
232 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
233 * libSBML determine such things as whether it is valid to assign a
234 * particular value to an attribute.  For packages, this means that the 
235 * parent object to which this package element is being added must have
236 * been created with the package namespace, or that the package namespace
237 * was added to it, even if that parent is not a package object itself.
238   */ public
239 ReferenceGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
240    this(libsbmlJNI.new_ReferenceGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
241  }
242
243  
244/**
245   * Creates a new {@link ReferenceGlyph}.  The id is given as the first
246   * argument, the id of the associated glyph is given as the
247   * second argument.  The third argument is the id of the associated
248   * reference and the fourth argument is the role.
249   */ public
250 ReferenceGlyph(LayoutPkgNamespaces layoutns, String sid, String glyphId, String referenceId, String role) throws org.sbml.libsbml.SBMLConstructorException {
251    this(libsbmlJNI.new_ReferenceGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, sid, glyphId, referenceId, role), true);
252  }
253
254  
255/**
256   * Creates a new {@link ReferenceGlyph} from the given {@link XMLNode}
257   */ public
258 ReferenceGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
259    this(libsbmlJNI.new_ReferenceGlyph__SWIG_6(XMLNode.getCPtr(node), node, l2version), true);
260  }
261
262  
263/**
264   * Creates a new {@link ReferenceGlyph} from the given {@link XMLNode}
265   */ public
266 ReferenceGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
267    this(libsbmlJNI.new_ReferenceGlyph__SWIG_7(XMLNode.getCPtr(node), node), true);
268  }
269
270  
271/**
272   * Copy constructor.
273   <p>
274   * @param source the instance to copy.
275   */ public
276 ReferenceGlyph(ReferenceGlyph source) throws org.sbml.libsbml.SBMLConstructorException {
277    this(libsbmlJNI.new_ReferenceGlyph__SWIG_8(ReferenceGlyph.getCPtr(source), source), true);
278  }
279
280  
281/**
282   * <p>
283 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
284 * value.
285 <p>
286 * <p>
287 * In SBML, object identifiers are of a data type called <code>SId</code>.
288 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
289 * introduced for attribute values that refer to <code>SId</code> values; in
290 * previous Levels of SBML, this data type did not exist and attributes were
291 * simply described to as 'referring to an identifier', but the effective
292 * data type was the same as <code>SIdRef</code> in Level&nbsp;3.  These and
293 * other methods of libSBML refer to the type <code>SIdRef</code> for all
294 * Levels of SBML, even if the corresponding SBML specification did not
295 * explicitly name the data type.
296 <p>
297 * This method works by looking at all attributes and (if appropriate)
298 * mathematical formulas in MathML content, comparing the referenced
299 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
300 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
301 * descend into child elements.
302 <p>
303 * @param oldid the old identifier.
304 * @param newid the new identifier.
305   */ public
306 void renameSIdRefs(String oldid, String newid) {
307    libsbmlJNI.ReferenceGlyph_renameSIdRefs(swigCPtr, this, oldid, newid);
308  }
309
310  
311/**
312   * Returns the id of the associated glyph.
313   */ public
314 String getGlyphId() {
315    return libsbmlJNI.ReferenceGlyph_getGlyphId(swigCPtr, this);
316  }
317
318  
319/**
320   * Sets the id of the associated glyph.
321   */ public
322 void setGlyphId(String glyphId) {
323    libsbmlJNI.ReferenceGlyph_setGlyphId(swigCPtr, this, glyphId);
324  }
325
326  
327/**
328   * Returns the id of the associated sbml reference.
329   */ public
330 String getReferenceId() {
331    return libsbmlJNI.ReferenceGlyph_getReferenceId(swigCPtr, this);
332  }
333
334  
335/**
336   * Sets the id of the associated sbml reference.
337   */ public
338 void setReferenceId(String id) {
339    libsbmlJNI.ReferenceGlyph_setReferenceId(swigCPtr, this, id);
340  }
341
342  
343/**
344   * Returns a string representation of the role.
345   */ public
346 String getRole() {
347    return libsbmlJNI.ReferenceGlyph_getRole(swigCPtr, this);
348  }
349
350  
351/**
352   * Sets the role.
353   */ public
354 void setRole(String role) {
355    libsbmlJNI.ReferenceGlyph_setRole(swigCPtr, this, role);
356  }
357
358  
359/**
360   * Returns the curve object for the reference glyph
361   */ public
362 Curve getCurve() {
363    long cPtr = libsbmlJNI.ReferenceGlyph_getCurve__SWIG_0(swigCPtr, this);
364    return (cPtr == 0) ? null : new Curve(cPtr, false);
365  }
366
367  
368/**
369   * Sets the curve object for the reference glyph.
370   */ public
371 void setCurve(Curve curve) {
372    libsbmlJNI.ReferenceGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve);
373  }
374
375  
376/**
377   * Returns <code>true</code> if the curve consists of one or more segments.
378   */ public
379 boolean isSetCurve() {
380    return libsbmlJNI.ReferenceGlyph_isSetCurve(swigCPtr, this);
381  }
382
383  
384/** */ public
385 boolean getCurveExplicitlySet() {
386    return libsbmlJNI.ReferenceGlyph_getCurveExplicitlySet(swigCPtr, this);
387  }
388
389  
390/**
391   * Returns <code>true</code> if the id of the associated glyph is not the
392   * empty string.
393   */ public
394 boolean isSetGlyphId() {
395    return libsbmlJNI.ReferenceGlyph_isSetGlyphId(swigCPtr, this);
396  }
397
398  
399/**
400   * Returns <code>true</code> if the id of the associated reference is not the
401   * empty string.
402   */ public
403 boolean isSetReferenceId() {
404    return libsbmlJNI.ReferenceGlyph_isSetReferenceId(swigCPtr, this);
405  }
406
407  
408/**
409   * Returns <code>true</code> of role is different from the empty string.
410   */ public
411 boolean isSetRole() {
412    return libsbmlJNI.ReferenceGlyph_isSetRole(swigCPtr, this);
413  }
414
415  
416/**
417   * Calls initDefaults on {@link GraphicalObject} 
418   */ public
419 void initDefaults() {
420    libsbmlJNI.ReferenceGlyph_initDefaults(swigCPtr, this);
421  }
422
423  
424/**
425   * Creates a new {@link LineSegment} object, adds it to the end of the list of
426   * curve segment objects of the curve and returns a reference to the
427   * newly created object.
428   */ public
429 LineSegment createLineSegment() {
430    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.ReferenceGlyph_createLineSegment(swigCPtr, this), false);
431}
432
433  
434/**
435   * Creates a new {@link CubicBezier} object, adds it to the end of the list of
436   * curve segment objects of the curve and returns a reference to the
437   * newly created object.
438   */ public
439 CubicBezier createCubicBezier() {
440    long cPtr = libsbmlJNI.ReferenceGlyph_createCubicBezier(swigCPtr, this);
441    return (cPtr == 0) ? null : new CubicBezier(cPtr, false);
442  }
443
444  
445/**
446   * Returns the XML element name of
447   * this SBML object.
448   <p>
449   * @return the string of the name of this element.
450   */ public
451 String getElementName() {
452    return libsbmlJNI.ReferenceGlyph_getElementName(swigCPtr, this);
453  }
454
455  
456/**
457   * Creates and returns a deep copy of this {@link ReferenceGlyph}.
458   <p>
459   * @return a (deep) copy of this {@link ReferenceGlyph}.
460   */ public
461 ReferenceGlyph cloneObject() {
462    long cPtr = libsbmlJNI.ReferenceGlyph_cloneObject(swigCPtr, this);
463    return (cPtr == 0) ? null : new ReferenceGlyph(cPtr, true);
464  }
465
466  
467/**
468   * Returns the libSBML type code of this object instance.
469   <p>
470   * <p>
471 * LibSBML attaches an identifying code to every kind of SBML object.  These
472 * are integer constants known as <em>SBML type codes</em>.  The names of all
473 * the codes begin with the characters <code>SBML_</code>.
474 * In the Java language interface for libSBML, the
475 * type codes are defined as static integer constants in the interface class
476 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
477 * package plug-ins may use overlapping type codes; to identify the package
478 * to which a given object belongs, call the 
479 * <code>{@link SBase#getPackageName()}
480 * </code>
481 * method on the object.
482   <p>
483   * @return the SBML type code for this object:
484   * {@link libsbmlConstants#SBML_LAYOUT_REFERENCEGLYPH SBML_LAYOUT_REFERENCEGLYPH}.
485   <p>
486   * <p>
487 * @warning <span class='warning'>The specific integer values of the possible
488 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
489 * packages,  To fully identify the correct code, <strong>it is necessary to
490 * invoke both getTypeCode() and getPackageName()</strong>.</span>
491   <p>
492   * @see #getElementName()
493   * @see #getPackageName()
494   */ public
495 int getTypeCode() {
496    return libsbmlJNI.ReferenceGlyph_getTypeCode(swigCPtr, this);
497  }
498
499  
500/**
501    * Creates an {@link XMLNode} object from this.
502    */ public
503 XMLNode toXML() {
504    return new XMLNode(libsbmlJNI.ReferenceGlyph_toXML(swigCPtr, this), true);
505  }
506
507  public void connectToChild() {
508    libsbmlJNI.ReferenceGlyph_connectToChild(swigCPtr, this);
509  }
510
511  
512/** * @internal */ public
513 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
514    libsbmlJNI.ReferenceGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
515  }
516
517}