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 A SpeciesReferenceGlyph represents a reactant or
015 * product from a {@link Reaction} in the &ldquo;layout&rdquo; package.
016 <p>
017 * The SpeciesReferenceGlyph element describes the graphical connection
018 * between a {@link SpeciesGlyph} and a {@link ReactionGlyph} (which would be an arrow or
019 * some curve in most cases). A {@link SpeciesReferenceGlyph} inherits from
020 * {@link GraphicalObject}, and adds a mandatory attribute 'speciesGlyph' and two
021 * optional attributes 'speciesReference' and 'role'. Optionally, the
022 * {@link SpeciesReferenceGlyph} also has a child element 'curve'.
023 <p>
024 * If the curve is specified, it overrides the inherited bounding box.
025 */
026
027public class SpeciesReferenceGlyph extends GraphicalObject {
028   private long swigCPtr;
029
030   protected SpeciesReferenceGlyph(long cPtr, boolean cMemoryOwn)
031   {
032     super(libsbmlJNI.SpeciesReferenceGlyph_SWIGUpcast(cPtr), cMemoryOwn);
033     swigCPtr = cPtr;
034   }
035
036   protected static long getCPtr(SpeciesReferenceGlyph obj)
037   {
038     return (obj == null) ? 0 : obj.swigCPtr;
039   }
040
041   protected static long getCPtrAndDisown (SpeciesReferenceGlyph 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_SpeciesReferenceGlyph(swigCPtr);
063      }
064      swigCPtr = 0;
065    }
066    super.delete();
067  }
068
069  
070/**
071   * Creates a new {@link SpeciesReferenceGlyph} with the given SBML level, version and
072   * package version.  The id if the associated species
073   * reference and the id of the associated species glyph are set to the
074   * empty string.  The role is set to SPECIES_ROLE_UNDEFINED.
075   */ public
076 SpeciesReferenceGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
077    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_0(level, version, pkgVersion), true);
078  }
079
080  
081/**
082   * Creates a new {@link SpeciesReferenceGlyph} with the given SBML level, version and
083   * package version.  The id if the associated species
084   * reference and the id of the associated species glyph are set to the
085   * empty string.  The role is set to SPECIES_ROLE_UNDEFINED.
086   */ public
087 SpeciesReferenceGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
088    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_1(level, version), true);
089  }
090
091  
092/**
093   * Creates a new {@link SpeciesReferenceGlyph} with the given SBML level, version and
094   * package version.  The id if the associated species
095   * reference and the id of the associated species glyph are set to the
096   * empty string.  The role is set to SPECIES_ROLE_UNDEFINED.
097   */ public
098 SpeciesReferenceGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException {
099    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_2(level), 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   */ public
109 SpeciesReferenceGlyph() throws org.sbml.libsbml.SBMLConstructorException {
110    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_3(), true);
111  }
112
113  
114/**
115   * Ctor.
116   */ public
117 SpeciesReferenceGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
118    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
119  }
120
121  
122/**
123   * Creates a new {@link SpeciesReferenceGlyph}.  The id is given as the first
124   * argument, the id of the associated species glyph is given as the
125   * second argument.  The third argument is the id of the associated
126   * species reference and the fourth argument is the role.
127   */ public
128 SpeciesReferenceGlyph(LayoutPkgNamespaces layoutns, String sid, String speciesGlyphId, String speciesReferenceId, int role) throws org.sbml.libsbml.SBMLConstructorException {
129    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, sid, speciesGlyphId, speciesReferenceId, role), true);
130  }
131
132  
133/**
134   * Creates a new {@link SpeciesReferenceGlyph} from the given {@link XMLNode}
135   */ public
136 SpeciesReferenceGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
137    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_6(XMLNode.getCPtr(node), node, l2version), true);
138  }
139
140  
141/**
142   * Creates a new {@link SpeciesReferenceGlyph} from the given {@link XMLNode}
143   */ public
144 SpeciesReferenceGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
145    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_7(XMLNode.getCPtr(node), node), true);
146  }
147
148  
149/**
150   * Copy constructor.
151   */ public
152 SpeciesReferenceGlyph(SpeciesReferenceGlyph source) throws org.sbml.libsbml.SBMLConstructorException {
153    this(libsbmlJNI.new_SpeciesReferenceGlyph__SWIG_8(SpeciesReferenceGlyph.getCPtr(source), source), true);
154  }
155
156  
157/**
158   * Returns the id of the associated {@link SpeciesGlyph}.
159   */ public
160 String getSpeciesGlyphId() {
161    return libsbmlJNI.SpeciesReferenceGlyph_getSpeciesGlyphId(swigCPtr, this);
162  }
163
164  
165/**
166   * Sets the id of the associated species glyph.
167   */ public
168 void setSpeciesGlyphId(String speciesGlyphId) {
169    libsbmlJNI.SpeciesReferenceGlyph_setSpeciesGlyphId(swigCPtr, this, speciesGlyphId);
170  }
171
172  
173/**
174   * Returns the id of the associated species reference.
175   */ public
176 String getSpeciesReferenceId() {
177    return libsbmlJNI.SpeciesReferenceGlyph_getSpeciesReferenceId(swigCPtr, this);
178  }
179
180  
181/**
182   * Sets the id of the associated species reference.
183   */ public
184 void setSpeciesReferenceId(String id) {
185    libsbmlJNI.SpeciesReferenceGlyph_setSpeciesReferenceId(swigCPtr, this, id);
186  }
187
188  
189/**
190   * Returns a string representation of the role.
191   */ public
192 String getRoleString() {
193    return libsbmlJNI.SpeciesReferenceGlyph_getRoleString(swigCPtr, this);
194  }
195
196  
197/**
198   * Returns the role.
199   */ public
200 int getRole() {
201    return libsbmlJNI.SpeciesReferenceGlyph_getRole(swigCPtr, this);
202  }
203
204  
205/**
206   * Sets the role based on a string.
207   * The String can be one of:
208   * SUBSTRATE
209   * PRODUCT
210   * SIDESUBSTRATE
211   * SIDEPRODUCT
212   * MODIFIER
213   * ACTIVATOR
214   * INHIBITOR    
215   */ public
216 void setRole(String role) {
217    libsbmlJNI.SpeciesReferenceGlyph_setRole__SWIG_0(swigCPtr, this, role);
218  }
219
220  
221/**
222   * Sets the role.
223   */ public
224 void setRole(int role) {
225    libsbmlJNI.SpeciesReferenceGlyph_setRole__SWIG_1(swigCPtr, this, role);
226  }
227
228  
229/**
230   * Renames all the <code>SIdRef</code> attributes on this element, including any
231   * found in MathML content (if such exists).
232   <p>
233   * This method works by looking at all attributes and (if appropriate)
234   * mathematical formulas, comparing the identifiers to the value of 
235   * <code>oldid</code>.  If any matches are found, the matching identifiers are replaced
236   * with <code>newid</code>.  The method does <em>not</em> descend into child elements.
237   <p>
238   * @param oldid the old identifier
239   * @param newid the new identifier
240   */ public
241 void renameSIdRefs(String oldid, String newid) {
242    libsbmlJNI.SpeciesReferenceGlyph_renameSIdRefs(swigCPtr, this, oldid, newid);
243  }
244
245  
246/**
247   * Returns the curve object for the species reference glyph
248   */ public
249 Curve getCurve() {
250    long cPtr = libsbmlJNI.SpeciesReferenceGlyph_getCurve__SWIG_0(swigCPtr, this);
251    return (cPtr == 0) ? null : new Curve(cPtr, false);
252  }
253
254  
255/**
256   * Sets the curve object for the species reference glyph.
257   */ public
258 void setCurve(Curve curve) {
259    libsbmlJNI.SpeciesReferenceGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve);
260  }
261
262  
263/**
264   * Returns true if the curve consists of one or more segments.
265   */ public
266 boolean isSetCurve() {
267    return libsbmlJNI.SpeciesReferenceGlyph_isSetCurve(swigCPtr, this);
268  }
269
270  
271/** */ public
272 boolean getCurveExplicitlySet() {
273    return libsbmlJNI.SpeciesReferenceGlyph_getCurveExplicitlySet(swigCPtr, this);
274  }
275
276  
277/**
278   * Returns true if the id of the associated species glyph is not the
279   * empty string.
280   */ public
281 boolean isSetSpeciesGlyphId() {
282    return libsbmlJNI.SpeciesReferenceGlyph_isSetSpeciesGlyphId(swigCPtr, this);
283  }
284
285  
286/**
287   * Returns true if the id of the associated species reference is not the
288   * empty string.
289   */ public
290 boolean isSetSpeciesReferenceId() {
291    return libsbmlJNI.SpeciesReferenceGlyph_isSetSpeciesReferenceId(swigCPtr, this);
292  }
293
294  
295/**
296   * Returns true of role is different from SPECIES_ROLE_UNDEFINED.
297   */ public
298 boolean isSetRole() {
299    return libsbmlJNI.SpeciesReferenceGlyph_isSetRole(swigCPtr, this);
300  }
301
302  
303/**
304   * Calls initDefaults on {@link GraphicalObject} and sets role to
305   * SPECIES_ROLE_UNDEFINED.
306   */ public
307 void initDefaults() {
308    libsbmlJNI.SpeciesReferenceGlyph_initDefaults(swigCPtr, this);
309  }
310
311  
312/**
313   * Creates a new {@link LineSegment} object, adds it to the end of the list of
314   * curve segment objects of the curve and returns a reference to the
315   * newly created object.
316   */ public
317 LineSegment createLineSegment() {
318    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.SpeciesReferenceGlyph_createLineSegment(swigCPtr, this), false);
319}
320
321  
322/**
323   * Creates a new {@link CubicBezier} object, adds it to the end of the list of
324   * curve segment objects of the curve and returns a reference to the
325   * newly created object.
326   */ public
327 CubicBezier createCubicBezier() {
328    long cPtr = libsbmlJNI.SpeciesReferenceGlyph_createCubicBezier(swigCPtr, this);
329    return (cPtr == 0) ? null : new CubicBezier(cPtr, false);
330  }
331
332  
333/**
334   * Returns the XML element name of
335   * this SBML object.
336   */ public
337 String getElementName() {
338    return libsbmlJNI.SpeciesReferenceGlyph_getElementName(swigCPtr, this);
339  }
340
341  
342/**
343   * Creates and returns a deep copy of this {@link SpeciesReferenceGlyph}.
344   <p>
345   * @return a (deep) copy of this {@link SpeciesReferenceGlyph}.
346   */ public
347 SpeciesReferenceGlyph cloneObject() {
348    long cPtr = libsbmlJNI.SpeciesReferenceGlyph_cloneObject(swigCPtr, this);
349    return (cPtr == 0) ? null : new SpeciesReferenceGlyph(cPtr, true);
350  }
351
352  
353/**
354   * Returns the libSBML type code of this object instance.
355   <p>
356   * <p>
357 * LibSBML attaches an identifying code to every kind of SBML object.  These
358 * are integer constants known as <em>SBML type codes</em>.  The names of all
359 * the codes begin with the characters &ldquo;<code>SBML_</code>&rdquo;. 
360 * In the Java language interface for libSBML, the
361 * type codes are defined as static integer constants in the interface class
362 * {@link libsbmlConstants}.    Note that different Level&nbsp;3 
363 * package plug-ins may use overlapping type codes; to identify the package
364 * to which a given object belongs, call the <code>getPackageName()</code>
365 * method on the object.
366   <p>
367   * @return the SBML type code for this object:
368   * {@link  libsbmlConstants#SBML_LAYOUT_SPECIESREFERENCEGLYPH SBML_LAYOUT_SPECIESREFERENCEGLYPH}
369   <p>
370   * <p>
371 * @warning <span class='warning'>The specific integer values of the possible
372 * type codes may be reused by different Level&nbsp;3 package plug-ins.
373 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
374 * both getTypeCode() and getPackageName()</strong>.</span>
375   <p>
376   * @see #getElementName()
377   * @see #getPackageName()
378   */ public
379 int getTypeCode() {
380    return libsbmlJNI.SpeciesReferenceGlyph_getTypeCode(swigCPtr, this);
381  }
382
383  
384/**
385    * Creates an {@link XMLNode} object from this.
386    */ public
387 XMLNode toXML() {
388    return new XMLNode(libsbmlJNI.SpeciesReferenceGlyph_toXML(swigCPtr, this), true);
389  }
390
391  
392/**
393   * Sets this SBML object to child SBML objects (if any).
394   * (Creates a child-parent relationship by the parent)
395   <p>
396   * Subclasses must override this function if they define
397   * one ore more child elements.
398   * Basically, this function needs to be called in
399   * constructor, copy constructor, assignment operator.
400   <p>
401   * @see setSBMLDocument
402   * @see enablePackageInternal
403   * @internal
404   */ public
405 void connectToChild() {
406    libsbmlJNI.SpeciesReferenceGlyph_connectToChild(swigCPtr, this);
407  }
408
409  
410/**
411   * Enables/Disables the given package with this element and child
412   * elements (if any).
413   * (This is an internal implementation for enablePakcage function)
414   <p>
415   * @note Subclasses in which one or more child elements are defined
416   * must override this function.
417   * @internal
418   */ public
419 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
420    libsbmlJNI.SpeciesReferenceGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
421  }
422
423}