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 A glyph for an SBML reaction.
015 <p>
016 * Analogous to how a {@link Reaction} object has to at least have one reactant or
017 * product, the {@link ReactionGlyph} has to at least have one {@link SpeciesReferenceGlyph}
018 * stored in the {@link ListOfSpeciesReferenceGlyphs}. Figure 12 on the following
019 * page provides the UML diagram for the class definition.  The {@link ReactionGlyph}
020 * inherits from {@link GraphicalObject}. In addition to the attributes inherited
021 * from {@link GraphicalObject}, the {@link ReactionGlyph} is described by an attribute
022 * reaction, a {@link Curve} element and a listOfSpeciesReferenceGlyphs element.  The
023 * {@link Curve} describes the center section of a {@link ReactionGlyph}. The center section
024 * is frequently used by tools to separate the point where substrates arcs
025 * come together, from the point where product arcs split off. The {@link Curve} is
026 * optional, and when not present the dimensions of the inherited {@link BoundingBox}
027 * describes the center section, by storing its position and dimension.
028 */
029
030public class ReactionGlyph extends GraphicalObject {
031   private long swigCPtr;
032
033   protected ReactionGlyph(long cPtr, boolean cMemoryOwn)
034   {
035     super(libsbmlJNI.ReactionGlyph_SWIGUpcast(cPtr), cMemoryOwn);
036     swigCPtr = cPtr;
037   }
038
039   protected static long getCPtr(ReactionGlyph obj)
040   {
041     return (obj == null) ? 0 : obj.swigCPtr;
042   }
043
044   protected static long getCPtrAndDisown (ReactionGlyph obj)
045   {
046     long ptr = 0;
047
048     if (obj != null)
049     {
050       ptr             = obj.swigCPtr;
051       obj.swigCMemOwn = false;
052     }
053
054     return ptr;
055   }
056
057  protected void finalize() {
058    delete();
059  }
060
061  public synchronized void delete() {
062    if (swigCPtr != 0) {
063      if (swigCMemOwn) {
064        swigCMemOwn = false;
065        libsbmlJNI.delete_ReactionGlyph(swigCPtr);
066      }
067      swigCPtr = 0;
068    }
069    super.delete();
070  }
071
072  
073/**
074   * Creates a new {@link ReactionGlyph}.  The list of species reference glyph is
075   * empty and the id of the associated reaction is set to the empty
076   * string.
077   <p>
078   * @param level the SBML Level.
079   * @param version the Version within the SBML Level.
080   * @param pkgVersion the version of the package.
081   <p>
082   * <p>
083 * @note Attempting to add an object to an {@link SBMLDocument} having a different
084 * combination of SBML Level, Version and XML namespaces than the object
085 * itself will result in an error at the time a caller attempts to make the
086 * addition.  A parent object must have compatible Level, Version and XML
087 * namespaces.  (Strictly speaking, a parent may also have more XML
088 * namespaces than a child, but the reverse is not permitted.)  The
089 * restriction is necessary to ensure that an SBML model has a consistent
090 * overall structure.  This requires callers to manage their objects
091 * carefully, but the benefit is increased flexibility in how models can be
092 * created by permitting callers to create objects bottom-up if desired.  In
093 * situations where objects are not yet attached to parents (e.g.,
094 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
095 * libSBML determine such things as whether it is valid to assign a
096 * particular value to an attribute.  For packages, this means that the 
097 * parent object to which this package element is being added must have
098 * been created with the package namespace, or that the package namespace
099 * was added to it, even if that parent is not a package object itself.
100   */ public
101 ReactionGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
102    this(libsbmlJNI.new_ReactionGlyph__SWIG_0(level, version, pkgVersion), true);
103  }
104
105  
106/**
107   * Creates a new {@link ReactionGlyph}.  The list of species reference glyph is
108   * empty and the id of the associated reaction is set to the empty
109   * string.
110   <p>
111   * @param level the SBML Level.
112   * @param version the Version within the SBML Level.
113   * @param pkgVersion the version of the package.
114   <p>
115   * <p>
116 * @note Attempting to add an object to an {@link SBMLDocument} having a different
117 * combination of SBML Level, Version and XML namespaces than the object
118 * itself will result in an error at the time a caller attempts to make the
119 * addition.  A parent object must have compatible Level, Version and XML
120 * namespaces.  (Strictly speaking, a parent may also have more XML
121 * namespaces than a child, but the reverse is not permitted.)  The
122 * restriction is necessary to ensure that an SBML model has a consistent
123 * overall structure.  This requires callers to manage their objects
124 * carefully, but the benefit is increased flexibility in how models can be
125 * created by permitting callers to create objects bottom-up if desired.  In
126 * situations where objects are not yet attached to parents (e.g.,
127 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
128 * libSBML determine such things as whether it is valid to assign a
129 * particular value to an attribute.  For packages, this means that the 
130 * parent object to which this package element is being added must have
131 * been created with the package namespace, or that the package namespace
132 * was added to it, even if that parent is not a package object itself.
133   */ public
134 ReactionGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
135    this(libsbmlJNI.new_ReactionGlyph__SWIG_1(level, version), true);
136  }
137
138  
139/**
140   * Creates a new {@link ReactionGlyph}.  The list of species reference glyph is
141   * empty and the id of the associated reaction is set to the empty
142   * string.
143   <p>
144   * @param level the SBML Level.
145   * @param version the Version within the SBML Level.
146   * @param pkgVersion the version of the package.
147   <p>
148   * <p>
149 * @note Attempting to add an object to an {@link SBMLDocument} having a different
150 * combination of SBML Level, Version and XML namespaces than the object
151 * itself will result in an error at the time a caller attempts to make the
152 * addition.  A parent object must have compatible Level, Version and XML
153 * namespaces.  (Strictly speaking, a parent may also have more XML
154 * namespaces than a child, but the reverse is not permitted.)  The
155 * restriction is necessary to ensure that an SBML model has a consistent
156 * overall structure.  This requires callers to manage their objects
157 * carefully, but the benefit is increased flexibility in how models can be
158 * created by permitting callers to create objects bottom-up if desired.  In
159 * situations where objects are not yet attached to parents (e.g.,
160 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
161 * libSBML determine such things as whether it is valid to assign a
162 * particular value to an attribute.  For packages, this means that the 
163 * parent object to which this package element is being added must have
164 * been created with the package namespace, or that the package namespace
165 * was added to it, even if that parent is not a package object itself.
166   */ public
167 ReactionGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException {
168    this(libsbmlJNI.new_ReactionGlyph__SWIG_2(level), true);
169  }
170
171  
172/**
173   * Creates a new {@link ReactionGlyph}.  The list of species reference glyph is
174   * empty and the id of the associated reaction is set to the empty
175   * string.
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 ReactionGlyph() throws org.sbml.libsbml.SBMLConstructorException {
201    this(libsbmlJNI.new_ReactionGlyph__SWIG_3(), true);
202  }
203
204  
205/**
206   * Creates a new {@link ReactionGlyph} with the given {@link LayoutPkgNamespaces} object.
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 ReactionGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
240    this(libsbmlJNI.new_ReactionGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
241  }
242
243  
244/**
245   * Creates a ResctionGlyph with the given {@link LayoutPkgNamespaces} and id.
246   <p>
247   * (FOR BACKWARD COMPATIBILITY)
248   */ public
249 ReactionGlyph(LayoutPkgNamespaces layoutns, String id) throws org.sbml.libsbml.SBMLConstructorException {
250    this(libsbmlJNI.new_ReactionGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id), true);
251  }
252
253  
254/**
255   * Creates a ResctionGlyph with the given {@link LayoutPkgNamespaces}, id and set the id of the
256   * associated reaction to the second argument.
257   <p>
258   * (FOR BACKWARD COMPATIBILITY)
259   */ public
260 ReactionGlyph(LayoutPkgNamespaces layoutns, String id, String reactionId) throws org.sbml.libsbml.SBMLConstructorException {
261    this(libsbmlJNI.new_ReactionGlyph__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, reactionId), true);
262  }
263
264  
265/**
266   * Creates a new {@link ReactionGlyph} from the given {@link XMLNode}
267   <p>
268   * (FOR BACKWARD COMPATIBILITY)
269   */ public
270 ReactionGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
271    this(libsbmlJNI.new_ReactionGlyph__SWIG_7(XMLNode.getCPtr(node), node, l2version), true);
272  }
273
274  
275/**
276   * Creates a new {@link ReactionGlyph} from the given {@link XMLNode}
277   <p>
278   * (FOR BACKWARD COMPATIBILITY)
279   */ public
280 ReactionGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
281    this(libsbmlJNI.new_ReactionGlyph__SWIG_8(XMLNode.getCPtr(node), node), true);
282  }
283
284  
285/**
286   * Copy constructor.
287   <p>
288   * @param source the instance to copy.
289   */ public
290 ReactionGlyph(ReactionGlyph source) throws org.sbml.libsbml.SBMLConstructorException {
291    this(libsbmlJNI.new_ReactionGlyph__SWIG_9(ReactionGlyph.getCPtr(source), source), true);
292  }
293
294  
295/**
296   * Returns the id of the associated reaction.
297   */ public
298 String getReactionId() {
299    return libsbmlJNI.ReactionGlyph_getReactionId(swigCPtr, this);
300  }
301
302  
303/**
304   * Sets the id of the associated reaction.
305   */ public
306 int setReactionId(String id) {
307    return libsbmlJNI.ReactionGlyph_setReactionId(swigCPtr, this, id);
308  }
309
310  
311/**
312   * Returns <code>true</code> if the id of the associated reaction is not the empty
313   * string.
314   */ public
315 boolean isSetReactionId() {
316    return libsbmlJNI.ReactionGlyph_isSetReactionId(swigCPtr, this);
317  }
318
319  
320/**
321   * Returns the {@link ListOf} object that hold the species reference glyphs.
322   */ public
323 ListOfSpeciesReferenceGlyphs getListOfSpeciesReferenceGlyphs() {
324    long cPtr = libsbmlJNI.ReactionGlyph_getListOfSpeciesReferenceGlyphs(swigCPtr, this);
325    return (cPtr == 0) ? null : new ListOfSpeciesReferenceGlyphs(cPtr, false);
326  }
327
328  
329/**
330   * Returns the species reference glyph with the given <code>index</code>.
331   * If the index is invalid, <code>null</code> is returned.
332   */ public
333 SpeciesReferenceGlyph getSpeciesReferenceGlyph(long index) {
334    long cPtr = libsbmlJNI.ReactionGlyph_getSpeciesReferenceGlyph__SWIG_0(swigCPtr, this, index);
335    return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, false);
336  }
337
338  
339/**
340   * Adds a new species reference glyph to the list.
341   */ public
342 int addSpeciesReferenceGlyph(SpeciesReferenceGlyph glyph) {
343    return libsbmlJNI.ReactionGlyph_addSpeciesReferenceGlyph(swigCPtr, this, SpeciesReferenceGlyph.getCPtr(glyph), glyph);
344  }
345
346  
347/**
348   * Returns the number of species reference glyph objects.
349   */ public
350 long getNumSpeciesReferenceGlyphs() {
351    return libsbmlJNI.ReactionGlyph_getNumSpeciesReferenceGlyphs(swigCPtr, this);
352  }
353
354  
355/**
356   * Calls initDefaults from {@link GraphicalObject}.
357   */ public
358 void initDefaults() {
359    libsbmlJNI.ReactionGlyph_initDefaults(swigCPtr, this);
360  }
361
362  
363/**
364   * <p>
365 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
366 * value.
367 <p>
368 * <p>
369 * In SBML, object identifiers are of a data type called <code>SId</code>.
370 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
371 * introduced for attribute values that refer to <code>SId</code> values; in
372 * previous Levels of SBML, this data type did not exist and attributes were
373 * simply described to as 'referring to an identifier', but the effective
374 * data type was the same as <code>SIdRef</code> in Level&nbsp;3.  These and
375 * other methods of libSBML refer to the type <code>SIdRef</code> for all
376 * Levels of SBML, even if the corresponding SBML specification did not
377 * explicitly name the data type.
378 <p>
379 * This method works by looking at all attributes and (if appropriate)
380 * mathematical formulas in MathML content, comparing the referenced
381 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
382 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
383 * descend into child elements.
384 <p>
385 * @param oldid the old identifier.
386 * @param newid the new identifier.
387   */ public
388 void renameSIdRefs(String oldid, String newid) {
389    libsbmlJNI.ReactionGlyph_renameSIdRefs(swigCPtr, this, oldid, newid);
390  }
391
392  
393/**
394   * Returns the curve object for the reaction glyph
395   */ public
396 Curve getCurve() {
397    long cPtr = libsbmlJNI.ReactionGlyph_getCurve__SWIG_0(swigCPtr, this);
398    return (cPtr == 0) ? null : new Curve(cPtr, false);
399  }
400
401  
402/**
403   * Sets the curve object for the reaction glyph.
404   */ public
405 void setCurve(Curve curve) {
406    libsbmlJNI.ReactionGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve);
407  }
408
409  
410/**
411   * Returns <code>true</code> if the curve consists of one or more segments.
412   */ public
413 boolean isSetCurve() {
414    return libsbmlJNI.ReactionGlyph_isSetCurve(swigCPtr, this);
415  }
416
417  
418/** */ public
419 boolean getCurveExplicitlySet() {
420    return libsbmlJNI.ReactionGlyph_getCurveExplicitlySet(swigCPtr, this);
421  }
422
423  
424/**
425   * Creates a new {@link SpeciesReferenceGlyph} object, adds it to the end of the
426   * list of species reference objects and returns a reference to the newly
427   * created object.
428   */ public
429 SpeciesReferenceGlyph createSpeciesReferenceGlyph() {
430    long cPtr = libsbmlJNI.ReactionGlyph_createSpeciesReferenceGlyph(swigCPtr, this);
431    return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, false);
432  }
433
434  
435/**
436   * Creates a new {@link LineSegment} object, adds it to the end of the list of
437   * curve segment objects of the curve and returns a reference to the
438   * newly created object.
439   */ public
440 LineSegment createLineSegment() {
441    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.ReactionGlyph_createLineSegment(swigCPtr, this), false);
442}
443
444  
445/**
446   * Creates a new {@link CubicBezier} object, adds it to the end of the list of
447   * curve segment objects of the curve and returns a reference to the
448   * newly created object.
449   */ public
450 CubicBezier createCubicBezier() {
451    long cPtr = libsbmlJNI.ReactionGlyph_createCubicBezier(swigCPtr, this);
452    return (cPtr == 0) ? null : new CubicBezier(cPtr, false);
453  }
454
455  
456/**
457   * Remove the species reference glyph with the given <code>index</code>.
458   * A pointer to the object is returned. If no object has been removed, null
459   * is returned.
460   */ public
461 SpeciesReferenceGlyph removeSpeciesReferenceGlyph(long index) {
462    long cPtr = libsbmlJNI.ReactionGlyph_removeSpeciesReferenceGlyph__SWIG_0(swigCPtr, this, index);
463    return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, true);
464  }
465
466  
467/**
468   * Remove the species reference glyph with the given <code>id</code>.
469   * A pointer to the object is returned. If no object has been removed, null
470   * is returned.
471   */ public
472 SpeciesReferenceGlyph removeSpeciesReferenceGlyph(String id) {
473    long cPtr = libsbmlJNI.ReactionGlyph_removeSpeciesReferenceGlyph__SWIG_1(swigCPtr, this, id);
474    return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, true);
475  }
476
477  
478/**
479   * Returns the index of the species reference glyph with the given <code>id</code>.
480   * If the reaction glyph does not contain a species reference glyph with this
481   * id, the
482   * value of the maximum long integer is returned as an indicator.
483   */ public
484 long getIndexForSpeciesReferenceGlyph(String id) {
485    return libsbmlJNI.ReactionGlyph_getIndexForSpeciesReferenceGlyph(swigCPtr, this, id);
486  }
487
488  
489/**
490   * Returns the XML element name of
491   * this SBML object.
492   <p>
493   * @return the string of the name of this element.
494   */ public
495 String getElementName() {
496    return libsbmlJNI.ReactionGlyph_getElementName(swigCPtr, this);
497  }
498
499  
500/**
501   * Creates and returns a deep copy of this {@link ReactionGlyph} object.
502   <p>
503   * @return a (deep) copy of this {@link ReactionGlyph}.
504   */ public
505 ReactionGlyph cloneObject() {
506    long cPtr = libsbmlJNI.ReactionGlyph_cloneObject(swigCPtr, this);
507    return (cPtr == 0) ? null : new ReactionGlyph(cPtr, true);
508  }
509
510  
511/**
512   * Returns the libSBML type code of this object instance.
513   <p>
514   * <p>
515 * LibSBML attaches an identifying code to every kind of SBML object.  These
516 * are integer constants known as <em>SBML type codes</em>.  The names of all
517 * the codes begin with the characters <code>SBML_</code>.
518 * In the Java language interface for libSBML, the
519 * type codes are defined as static integer constants in the interface class
520 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
521 * package plug-ins may use overlapping type codes; to identify the package
522 * to which a given object belongs, call the 
523 * <code>{@link SBase#getPackageName()}
524 * </code>
525 * method on the object.
526   <p>
527   * @return the SBML type code for this object:
528   * {@link libsbmlConstants#SBML_LAYOUT_REACTIONGLYPH SBML_LAYOUT_REACTIONGLYPH}.
529   <p>
530   * <p>
531 * @warning <span class='warning'>The specific integer values of the possible
532 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
533 * packages,  To fully identify the correct code, <strong>it is necessary to
534 * invoke both getTypeCode() and getPackageName()</strong>.</span>
535   <p>
536   * @see #getElementName()
537   * @see #getPackageName()
538   */ public
539 int getTypeCode() {
540    return libsbmlJNI.ReactionGlyph_getTypeCode(swigCPtr, this);
541  }
542
543  
544/**
545    * Creates an {@link XMLNode} object from this.
546    */ public
547 XMLNode toXML() {
548    return new XMLNode(libsbmlJNI.ReactionGlyph_toXML(swigCPtr, this), true);
549  }
550
551  public void connectToChild() {
552    libsbmlJNI.ReactionGlyph_connectToChild(swigCPtr, this);
553  }
554
555  
556/** * @internal */ public
557 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
558    libsbmlJNI.ReactionGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
559  }
560
561}