001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.10
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 <em>species reference</em>.
015 <p>
016 * The SpeciesReferenceGlyph element describes the graphical connection
017 * between a {@link SpeciesGlyph} and a {@link ReactionGlyph} (which would be an arrow or
018 * some curve in most cases). A {@link SpeciesReferenceGlyph} inherits from
019 * {@link GraphicalObject}, and adds a mandatory attribute 'speciesGlyph' and two
020 * optional attributes 'speciesReference' and 'role'. Optionally, the
021 * {@link SpeciesReferenceGlyph} also has a child element 'curve'.
022 <p>
023 * If the curve is specified, it overrides the inherited bounding box.
024 */
025
026public class SpeciesReferenceGlyph extends GraphicalObject {
027   private long swigCPtr;
028
029   protected SpeciesReferenceGlyph(long cPtr, boolean cMemoryOwn)
030   {
031     super(libsbmlJNI.SpeciesReferenceGlyph_SWIGUpcast(cPtr), cMemoryOwn);
032     swigCPtr = cPtr;
033   }
034
035   protected static long getCPtr(SpeciesReferenceGlyph obj)
036   {
037     return (obj == null) ? 0 : obj.swigCPtr;
038   }
039
040   protected static long getCPtrAndDisown (SpeciesReferenceGlyph 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_SpeciesReferenceGlyph(swigCPtr);
062      }
063      swigCPtr = 0;
064    }
065    super.delete();
066  }
067
068  
069/**
070   * Creates a new {@link SpeciesReferenceGlyph} with the given SBML level, version and
071   * package version.  The id if the associated species
072   * reference and the id of the associated species glyph are set to the
073   * empty string.  The role is set to SPECIES_ROLE_UNDEFINED.
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 SpeciesReferenceGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
099    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_0(level, version, pkgVersion), true);
100  }
101
102  
103/**
104   * Creates a new {@link SpeciesReferenceGlyph} with the given SBML level, version and
105   * package version.  The id if the associated species
106   * reference and the id of the associated species glyph are set to the
107   * empty string.  The role is set to SPECIES_ROLE_UNDEFINED.
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 SpeciesReferenceGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
133    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_1(level, version), true);
134  }
135
136  
137/**
138   * Creates a new {@link SpeciesReferenceGlyph} with the given SBML level, version and
139   * package version.  The id if the associated species
140   * reference and the id of the associated species glyph are set to the
141   * empty string.  The role is set to SPECIES_ROLE_UNDEFINED.
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 SpeciesReferenceGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException {
167    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_2(level), true);
168  }
169
170  
171/**
172   * Creates a new {@link SpeciesReferenceGlyph} with the given SBML level, version and
173   * package version.  The id if the associated species
174   * reference and the id of the associated species glyph are set to the
175   * empty string.  The role is set to SPECIES_ROLE_UNDEFINED.
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 SpeciesReferenceGlyph() throws org.sbml.libsbml.SBMLConstructorException {
201    this(libsbmlJNI.new_SpeciesReferenceGlyph__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 SpeciesReferenceGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
240    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
241  }
242
243  
244/**
245   * Creates a new {@link SpeciesReferenceGlyph}.  The id is given as the first
246   * argument, the id of the associated species glyph is given as the
247   * second argument.  The third argument is the id of the associated
248   * species reference and the fourth argument is the role.
249   */ public
250 SpeciesReferenceGlyph(LayoutPkgNamespaces layoutns, String sid, String speciesGlyphId, String speciesReferenceId, int role) throws org.sbml.libsbml.SBMLConstructorException {
251    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, sid, speciesGlyphId, speciesReferenceId, role), true);
252  }
253
254  
255/**
256   * Creates a new {@link SpeciesReferenceGlyph} from the given {@link XMLNode}
257   */ public
258 SpeciesReferenceGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
259    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_6(XMLNode.getCPtr(node), node, l2version), true);
260  }
261
262  
263/**
264   * Creates a new {@link SpeciesReferenceGlyph} from the given {@link XMLNode}
265   */ public
266 SpeciesReferenceGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
267    this(libsbmlJNI.new_SpeciesReferenceGlyph__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 SpeciesReferenceGlyph(SpeciesReferenceGlyph source) throws org.sbml.libsbml.SBMLConstructorException {
277    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_8(SpeciesReferenceGlyph.getCPtr(source), source), true);
278  }
279
280  
281/**
282   * Returns the id of the associated {@link SpeciesGlyph}.
283   */ public
284 String getSpeciesGlyphId() {
285    return libsbmlJNI.SpeciesReferenceGlyph_getSpeciesGlyphId(swigCPtr, this);
286  }
287
288  
289/**
290   * Sets the id of the associated species glyph.
291   */ public
292 void setSpeciesGlyphId(String speciesGlyphId) {
293    libsbmlJNI.SpeciesReferenceGlyph_setSpeciesGlyphId(swigCPtr, this, speciesGlyphId);
294  }
295
296  
297/**
298   * Returns the id of the associated species reference.
299   */ public
300 String getSpeciesReferenceId() {
301    return libsbmlJNI.SpeciesReferenceGlyph_getSpeciesReferenceId(swigCPtr, this);
302  }
303
304  
305/**
306   * Sets the id of the associated species reference.
307   */ public
308 void setSpeciesReferenceId(String id) {
309    libsbmlJNI.SpeciesReferenceGlyph_setSpeciesReferenceId(swigCPtr, this, id);
310  }
311
312  
313/**
314   * Returns a string representation of the role.
315   */ public
316 String getRoleString() {
317    return libsbmlJNI.SpeciesReferenceGlyph_getRoleString(swigCPtr, this);
318  }
319
320  
321/**
322   * Returns the role.
323   */ public
324 int getRole() {
325    return libsbmlJNI.SpeciesReferenceGlyph_getRole(swigCPtr, this);
326  }
327
328  
329/**
330   * Sets the role based on a string.
331   * The String can be one of:
332   * SUBSTRATE
333   * PRODUCT
334   * SIDESUBSTRATE
335   * SIDEPRODUCT
336   * MODIFIER
337   * ACTIVATOR
338   * INHIBITOR    
339   */ public
340 void setRole(String role) {
341    libsbmlJNI.SpeciesReferenceGlyph_setRole__SWIG_0(swigCPtr, this, role);
342  }
343
344  
345/**
346   * Sets the role.
347   */ public
348 void setRole(int role) {
349    libsbmlJNI.SpeciesReferenceGlyph_setRole__SWIG_1(swigCPtr, this, role);
350  }
351
352  
353/**
354   * <p>
355 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
356 * value.
357 <p>
358 * <p>
359 * In SBML, object identifiers are of a data type called <code>SId</code>.
360 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
361 * introduced for attribute values that refer to <code>SId</code> values; in
362 * previous Levels of SBML, this data type did not exist and attributes were
363 * simply described to as 'referring to an identifier', but the effective
364 * data type was the same as <code>SIdRef</code> in Level&nbsp;3.  These and
365 * other methods of libSBML refer to the type <code>SIdRef</code> for all
366 * Levels of SBML, even if the corresponding SBML specification did not
367 * explicitly name the data type.
368 <p>
369 * This method works by looking at all attributes and (if appropriate)
370 * mathematical formulas in MathML content, comparing the referenced
371 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
372 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
373 * descend into child elements.
374 <p>
375 * @param oldid the old identifier.
376 * @param newid the new identifier.
377   */ public
378 void renameSIdRefs(String oldid, String newid) {
379    libsbmlJNI.SpeciesReferenceGlyph_renameSIdRefs(swigCPtr, this, oldid, newid);
380  }
381
382  
383/**
384   * Returns the curve object for the species reference glyph
385   */ public
386 Curve getCurve() {
387    long cPtr = libsbmlJNI.SpeciesReferenceGlyph_getCurve__SWIG_0(swigCPtr, this);
388    return (cPtr == 0) ? null : new Curve(cPtr, false);
389  }
390
391  
392/**
393   * Sets the curve object for the species reference glyph.
394   */ public
395 void setCurve(Curve curve) {
396    libsbmlJNI.SpeciesReferenceGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve);
397  }
398
399  
400/**
401   * Returns <code>true</code> if the curve consists of one or more segments.
402   */ public
403 boolean isSetCurve() {
404    return libsbmlJNI.SpeciesReferenceGlyph_isSetCurve(swigCPtr, this);
405  }
406
407  
408/** */ public
409 boolean getCurveExplicitlySet() {
410    return libsbmlJNI.SpeciesReferenceGlyph_getCurveExplicitlySet(swigCPtr, this);
411  }
412
413  
414/**
415   * Returns <code>true</code> if the id of the associated species glyph is not the
416   * empty string.
417   */ public
418 boolean isSetSpeciesGlyphId() {
419    return libsbmlJNI.SpeciesReferenceGlyph_isSetSpeciesGlyphId(swigCPtr, this);
420  }
421
422  
423/**
424   * Returns <code>true</code> if the id of the associated species reference is not the
425   * empty string.
426   */ public
427 boolean isSetSpeciesReferenceId() {
428    return libsbmlJNI.SpeciesReferenceGlyph_isSetSpeciesReferenceId(swigCPtr, this);
429  }
430
431  
432/**
433   * Returns <code>true</code> of role is different from SPECIES_ROLE_UNDEFINED.
434   */ public
435 boolean isSetRole() {
436    return libsbmlJNI.SpeciesReferenceGlyph_isSetRole(swigCPtr, this);
437  }
438
439  
440/**
441   * Calls initDefaults on {@link GraphicalObject} and sets role to
442   * SPECIES_ROLE_UNDEFINED.
443   */ public
444 void initDefaults() {
445    libsbmlJNI.SpeciesReferenceGlyph_initDefaults(swigCPtr, this);
446  }
447
448  
449/**
450   * Creates a new {@link LineSegment} object, adds it to the end of the list of
451   * curve segment objects of the curve and returns a reference to the
452   * newly created object.
453   */ public
454 LineSegment createLineSegment() {
455    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.SpeciesReferenceGlyph_createLineSegment(swigCPtr, this), false);
456}
457
458  
459/**
460   * Creates a new {@link CubicBezier} object, adds it to the end of the list of
461   * curve segment objects of the curve and returns a reference to the
462   * newly created object.
463   */ public
464 CubicBezier createCubicBezier() {
465    long cPtr = libsbmlJNI.SpeciesReferenceGlyph_createCubicBezier(swigCPtr, this);
466    return (cPtr == 0) ? null : new CubicBezier(cPtr, false);
467  }
468
469  
470/**
471   * Returns the XML element name of
472   * this SBML object.
473   <p>
474   * @return the string of the name of this element.
475   */ public
476 String getElementName() {
477    return libsbmlJNI.SpeciesReferenceGlyph_getElementName(swigCPtr, this);
478  }
479
480  
481/**
482   * Creates and returns a deep copy of this {@link SpeciesReferenceGlyph}.
483   <p>
484   * @return a (deep) copy of this {@link SpeciesReferenceGlyph}.
485   */ public
486 SpeciesReferenceGlyph cloneObject() {
487    long cPtr = libsbmlJNI.SpeciesReferenceGlyph_cloneObject(swigCPtr, this);
488    return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, true);
489  }
490
491  
492/**
493   * Returns the libSBML type code of this object instance.
494   <p>
495   * <p>
496 * LibSBML attaches an identifying code to every kind of SBML object.  These
497 * are integer constants known as <em>SBML type codes</em>.  The names of all
498 * the codes begin with the characters <code>SBML_</code>.
499 * In the Java language interface for libSBML, the
500 * type codes are defined as static integer constants in the interface class
501 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
502 * package plug-ins may use overlapping type codes; to identify the package
503 * to which a given object belongs, call the <code>getPackageName()</code>
504 * method on the object.
505   <p>
506   * @return the SBML type code for this object:
507   * {@link libsbmlConstants#SBML_LAYOUT_SPECIESREFERENCEGLYPH SBML_LAYOUT_SPECIESREFERENCEGLYPH}.
508   <p>
509   * <p>
510 * @warning <span class='warning'>The specific integer values of the possible
511 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
512 * packages,  To fully identify the correct code, <strong>it is necessary to
513 * invoke both getTypeCode() and getPackageName()</strong>.</span>
514   <p>
515   * @see #getElementName()
516   * @see #getPackageName()
517   */ public
518 int getTypeCode() {
519    return libsbmlJNI.SpeciesReferenceGlyph_getTypeCode(swigCPtr, this);
520  }
521
522  
523/**
524    * Creates an {@link XMLNode} object from this.
525    */ public
526 XMLNode toXML() {
527    return new XMLNode(libsbmlJNI.SpeciesReferenceGlyph_toXML(swigCPtr, this), true);
528  }
529
530  public void connectToChild() {
531    libsbmlJNI.SpeciesReferenceGlyph_connectToChild(swigCPtr, this);
532  }
533
534  
535/** * @internal */ public
536 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
537    libsbmlJNI.SpeciesReferenceGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
538  }
539
540}