001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.7
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   */ public
075 ReferenceGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
076    this(libsbmlJNI.new_ReferenceGlyph__SWIG_0(level, version, pkgVersion), true);
077  }
078
079  
080/**
081   * Creates a new {@link ReferenceGlyph} with the given SBML level, version and
082   * package version.  The id if the associated 
083   * reference and the id of the associated  glyph are set to the
084   * empty string.  The role is set to empty.
085   */ public
086 ReferenceGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
087    this(libsbmlJNI.new_ReferenceGlyph__SWIG_1(level, version), true);
088  }
089
090  
091/**
092   * Creates a new {@link ReferenceGlyph} with the given SBML level, version and
093   * package version.  The id if the associated 
094   * reference and the id of the associated  glyph are set to the
095   * empty string.  The role is set to empty.
096   */ public
097 ReferenceGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException {
098    this(libsbmlJNI.new_ReferenceGlyph__SWIG_2(level), true);
099  }
100
101  
102/**
103   * Creates a new {@link ReferenceGlyph} with the given SBML level, version and
104   * package version.  The id if the associated 
105   * reference and the id of the associated  glyph are set to the
106   * empty string.  The role is set to empty.
107   */ public
108 ReferenceGlyph() throws org.sbml.libsbml.SBMLConstructorException {
109    this(libsbmlJNI.new_ReferenceGlyph__SWIG_3(), true);
110  }
111
112  
113/**
114   * Ctor.
115   */ public
116 ReferenceGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
117    this(libsbmlJNI.new_ReferenceGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
118  }
119
120  
121/**
122   * Creates a new {@link ReferenceGlyph}.  The id is given as the first
123   * argument, the id of the associated glyph is given as the
124   * second argument.  The third argument is the id of the associated
125   * reference and the fourth argument is the role.
126   */ public
127 ReferenceGlyph(LayoutPkgNamespaces layoutns, String sid, String glyphId, String referenceId, String role) throws org.sbml.libsbml.SBMLConstructorException {
128    this(libsbmlJNI.new_ReferenceGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, sid, glyphId, referenceId, role), true);
129  }
130
131  
132/**
133   * Creates a new {@link ReferenceGlyph} from the given {@link XMLNode}
134   */ public
135 ReferenceGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
136    this(libsbmlJNI.new_ReferenceGlyph__SWIG_6(XMLNode.getCPtr(node), node, l2version), true);
137  }
138
139  
140/**
141   * Creates a new {@link ReferenceGlyph} from the given {@link XMLNode}
142   */ public
143 ReferenceGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
144    this(libsbmlJNI.new_ReferenceGlyph__SWIG_7(XMLNode.getCPtr(node), node), true);
145  }
146
147  
148/**
149   * Copy constructor.
150   */ public
151 ReferenceGlyph(ReferenceGlyph source) throws org.sbml.libsbml.SBMLConstructorException {
152    this(libsbmlJNI.new_ReferenceGlyph__SWIG_8(ReferenceGlyph.getCPtr(source), source), true);
153  }
154
155  
156/**
157   * <p>
158 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
159 * value.
160 <p>
161 * <p>
162 * In SBML, object identifiers are of a data type called <code>SId</code>.
163 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
164 * introduced for attribute values that refer to <code>SId</code> values; in
165 * previous Levels of SBML, this data type did not exist and attributes were
166 * simply described to as 'referring to an identifier', but the effective
167 * data type was the same as <code>SIdRef</code>in Level&nbsp;3.  These and
168 * other methods of libSBML refer to the type <code>SIdRef</code> for all
169 * Levels of SBML, even if the corresponding SBML specification did not
170 * explicitly name the data type.
171 <p>
172 * This method works by looking at all attributes and (if appropriate)
173 * mathematical formulas in MathML content, comparing the referenced
174 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
175 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
176 * descend into child elements.
177 <p>
178 * @param oldid the old identifier
179 * @param newid the new identifier
180   */ public
181 void renameSIdRefs(String oldid, String newid) {
182    libsbmlJNI.ReferenceGlyph_renameSIdRefs(swigCPtr, this, oldid, newid);
183  }
184
185  
186/**
187   * Returns the id of the associated glyph.
188   */ public
189 String getGlyphId() {
190    return libsbmlJNI.ReferenceGlyph_getGlyphId(swigCPtr, this);
191  }
192
193  
194/**
195   * Sets the id of the associated glyph.
196   */ public
197 void setGlyphId(String glyphId) {
198    libsbmlJNI.ReferenceGlyph_setGlyphId(swigCPtr, this, glyphId);
199  }
200
201  
202/**
203   * Returns the id of the associated sbml reference.
204   */ public
205 String getReferenceId() {
206    return libsbmlJNI.ReferenceGlyph_getReferenceId(swigCPtr, this);
207  }
208
209  
210/**
211   * Sets the id of the associated sbml reference.
212   */ public
213 void setReferenceId(String id) {
214    libsbmlJNI.ReferenceGlyph_setReferenceId(swigCPtr, this, id);
215  }
216
217  
218/**
219   * Returns a string representation of the role.
220   */ public
221 String getRole() {
222    return libsbmlJNI.ReferenceGlyph_getRole(swigCPtr, this);
223  }
224
225  
226/**
227   * Sets the role.
228   */ public
229 void setRole(String role) {
230    libsbmlJNI.ReferenceGlyph_setRole(swigCPtr, this, role);
231  }
232
233  
234/**
235   * Returns the curve object for the reference glyph
236   */ public
237 Curve getCurve() {
238    long cPtr = libsbmlJNI.ReferenceGlyph_getCurve__SWIG_0(swigCPtr, this);
239    return (cPtr == 0) ? null : new Curve(cPtr, false);
240  }
241
242  
243/**
244   * Sets the curve object for the reference glyph.
245   */ public
246 void setCurve(Curve curve) {
247    libsbmlJNI.ReferenceGlyph_setCurve(swigCPtr, this, Curve.getCPtr(curve), curve);
248  }
249
250  
251/**
252   * Returns true if the curve consists of one or more segments.
253   */ public
254 boolean isSetCurve() {
255    return libsbmlJNI.ReferenceGlyph_isSetCurve(swigCPtr, this);
256  }
257
258  
259/** */ public
260 boolean getCurveExplicitlySet() {
261    return libsbmlJNI.ReferenceGlyph_getCurveExplicitlySet(swigCPtr, this);
262  }
263
264  
265/**
266   * Returns true if the id of the associated glyph is not the
267   * empty string.
268   */ public
269 boolean isSetGlyphId() {
270    return libsbmlJNI.ReferenceGlyph_isSetGlyphId(swigCPtr, this);
271  }
272
273  
274/**
275   * Returns true if the id of the associated reference is not the
276   * empty string.
277   */ public
278 boolean isSetReferenceId() {
279    return libsbmlJNI.ReferenceGlyph_isSetReferenceId(swigCPtr, this);
280  }
281
282  
283/**
284   * Returns true of role is different from the empty string.
285   */ public
286 boolean isSetRole() {
287    return libsbmlJNI.ReferenceGlyph_isSetRole(swigCPtr, this);
288  }
289
290  
291/**
292   * Calls initDefaults on {@link GraphicalObject} 
293   */ public
294 void initDefaults() {
295    libsbmlJNI.ReferenceGlyph_initDefaults(swigCPtr, this);
296  }
297
298  
299/**
300   * Creates a new {@link LineSegment} object, adds it to the end of the list of
301   * curve segment objects of the curve and returns a reference to the
302   * newly created object.
303   */ public
304 LineSegment createLineSegment() {
305    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.ReferenceGlyph_createLineSegment(swigCPtr, this), false);
306}
307
308  
309/**
310   * Creates a new {@link CubicBezier} object, adds it to the end of the list of
311   * curve segment objects of the curve and returns a reference to the
312   * newly created object.
313   */ public
314 CubicBezier createCubicBezier() {
315    long cPtr = libsbmlJNI.ReferenceGlyph_createCubicBezier(swigCPtr, this);
316    return (cPtr == 0) ? null : new CubicBezier(cPtr, false);
317  }
318
319  
320/**
321   * Returns the XML element name of
322   * this SBML object.
323   <p>
324   * @return the string of the name of this element
325   */ public
326 String getElementName() {
327    return libsbmlJNI.ReferenceGlyph_getElementName(swigCPtr, this);
328  }
329
330  
331/**
332   * Creates and returns a deep copy of this {@link ReferenceGlyph}.
333   <p>
334   * @return a (deep) copy of this {@link ReferenceGlyph}.
335   */ public
336 ReferenceGlyph cloneObject() {
337    long cPtr = libsbmlJNI.ReferenceGlyph_cloneObject(swigCPtr, this);
338    return (cPtr == 0) ? null : new ReferenceGlyph(cPtr, true);
339  }
340
341  
342/**
343   * Returns the libSBML type code of this object instance.
344   <p>
345   * <p>
346 * LibSBML attaches an identifying code to every kind of SBML object.  These
347 * are integer constants known as <em>SBML type codes</em>.  The names of all
348 * the codes begin with the characters <code>SBML_</code>.
349 * In the Java language interface for libSBML, the
350 * type codes are defined as static integer constants in the interface class
351 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
352 * package plug-ins may use overlapping type codes; to identify the package
353 * to which a given object belongs, call the <code>getPackageName()</code>
354 * method on the object.
355   <p>
356   * @return the SBML type code for this object:
357   * {@link libsbmlConstants#SBML_LAYOUT_REFERENCEGLYPH SBML_LAYOUT_REFERENCEGLYPH}
358   <p>
359   * <p>
360 * @warning <span class='warning'>The specific integer values of the possible
361 * type codes may be reused by different Level&nbsp;3 package plug-ins.
362 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
363 * both getTypeCode() and getPackageName()</strong>.</span>
364   <p>
365   * @see #getElementName()
366   * @see #getPackageName()
367   */ public
368 int getTypeCode() {
369    return libsbmlJNI.ReferenceGlyph_getTypeCode(swigCPtr, this);
370  }
371
372  
373/**
374    * Creates an {@link XMLNode} object from this.
375    */ public
376 XMLNode toXML() {
377    return new XMLNode(libsbmlJNI.ReferenceGlyph_toXML(swigCPtr, this), true);
378  }
379
380  public void connectToChild() {
381    libsbmlJNI.ReferenceGlyph_connectToChild(swigCPtr, this);
382  }
383
384  
385/** * @internal */ public
386 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
387    libsbmlJNI.ReferenceGlyph_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
388  }
389
390}