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 a text label.
015 <p>
016 * The TextGlyph class describes the position and dimension of text labels
017 * in the &ldquo;layout&rdquo; package.  It inherits from {@link GraphicalObject} and
018 * adds the attributes graphicalObject, text and originOfText.
019 */
020
021public class TextGlyph extends GraphicalObject {
022   private long swigCPtr;
023
024   protected TextGlyph(long cPtr, boolean cMemoryOwn)
025   {
026     super(libsbmlJNI.TextGlyph_SWIGUpcast(cPtr), cMemoryOwn);
027     swigCPtr = cPtr;
028   }
029
030   protected static long getCPtr(TextGlyph obj)
031   {
032     return (obj == null) ? 0 : obj.swigCPtr;
033   }
034
035   protected static long getCPtrAndDisown (TextGlyph obj)
036   {
037     long ptr = 0;
038
039     if (obj != null)
040     {
041       ptr             = obj.swigCPtr;
042       obj.swigCMemOwn = false;
043     }
044
045     return ptr;
046   }
047
048  protected void finalize() {
049    delete();
050  }
051
052  public synchronized void delete() {
053    if (swigCPtr != 0) {
054      if (swigCMemOwn) {
055        swigCMemOwn = false;
056        libsbmlJNI.delete_TextGlyph(swigCPtr);
057      }
058      swigCPtr = 0;
059    }
060    super.delete();
061  }
062
063  
064/**
065   * Creates a new {@link TextGlyph} with the given SBML level, versin and package
066   * version. The ids of the associated {@link GraphicalObject} and
067   * the originOfText are set to the empty string. The actual text is set
068   * to the empty string as well.
069   <p>
070   * @param level the SBML Level.
071   * @param version the Version within the SBML Level.
072   * @param pkgVersion the version of the package.
073   <p>
074   * <p>
075 * @note Attempting to add an object to an {@link SBMLDocument} having a different
076 * combination of SBML Level, Version and XML namespaces than the object
077 * itself will result in an error at the time a caller attempts to make the
078 * addition.  A parent object must have compatible Level, Version and XML
079 * namespaces.  (Strictly speaking, a parent may also have more XML
080 * namespaces than a child, but the reverse is not permitted.)  The
081 * restriction is necessary to ensure that an SBML model has a consistent
082 * overall structure.  This requires callers to manage their objects
083 * carefully, but the benefit is increased flexibility in how models can be
084 * created by permitting callers to create objects bottom-up if desired.  In
085 * situations where objects are not yet attached to parents (e.g.,
086 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
087 * libSBML determine such things as whether it is valid to assign a
088 * particular value to an attribute.  For packages, this means that the 
089 * parent object to which this package element is being added must have
090 * been created with the package namespace, or that the package namespace
091 * was added to it, even if that parent is not a package object itself.
092   */ public
093 TextGlyph(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
094    this(libsbmlJNI.new_TextGlyph__SWIG_0(level, version, pkgVersion), true);
095  }
096
097  
098/**
099   * Creates a new {@link TextGlyph} with the given SBML level, versin and package
100   * version. The ids of the associated {@link GraphicalObject} and
101   * the originOfText are set to the empty string. The actual text is set
102   * to the empty string as well.
103   <p>
104   * @param level the SBML Level.
105   * @param version the Version within the SBML Level.
106   * @param pkgVersion the version of the package.
107   <p>
108   * <p>
109 * @note Attempting to add an object to an {@link SBMLDocument} having a different
110 * combination of SBML Level, Version and XML namespaces than the object
111 * itself will result in an error at the time a caller attempts to make the
112 * addition.  A parent object must have compatible Level, Version and XML
113 * namespaces.  (Strictly speaking, a parent may also have more XML
114 * namespaces than a child, but the reverse is not permitted.)  The
115 * restriction is necessary to ensure that an SBML model has a consistent
116 * overall structure.  This requires callers to manage their objects
117 * carefully, but the benefit is increased flexibility in how models can be
118 * created by permitting callers to create objects bottom-up if desired.  In
119 * situations where objects are not yet attached to parents (e.g.,
120 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
121 * libSBML determine such things as whether it is valid to assign a
122 * particular value to an attribute.  For packages, this means that the 
123 * parent object to which this package element is being added must have
124 * been created with the package namespace, or that the package namespace
125 * was added to it, even if that parent is not a package object itself.
126   */ public
127 TextGlyph(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
128    this(libsbmlJNI.new_TextGlyph__SWIG_1(level, version), true);
129  }
130
131  
132/**
133   * Creates a new {@link TextGlyph} with the given SBML level, versin and package
134   * version. The ids of the associated {@link GraphicalObject} and
135   * the originOfText are set to the empty string. The actual text is set
136   * to the empty string as well.
137   <p>
138   * @param level the SBML Level.
139   * @param version the Version within the SBML Level.
140   * @param pkgVersion the version of the package.
141   <p>
142   * <p>
143 * @note Attempting to add an object to an {@link SBMLDocument} having a different
144 * combination of SBML Level, Version and XML namespaces than the object
145 * itself will result in an error at the time a caller attempts to make the
146 * addition.  A parent object must have compatible Level, Version and XML
147 * namespaces.  (Strictly speaking, a parent may also have more XML
148 * namespaces than a child, but the reverse is not permitted.)  The
149 * restriction is necessary to ensure that an SBML model has a consistent
150 * overall structure.  This requires callers to manage their objects
151 * carefully, but the benefit is increased flexibility in how models can be
152 * created by permitting callers to create objects bottom-up if desired.  In
153 * situations where objects are not yet attached to parents (e.g.,
154 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
155 * libSBML determine such things as whether it is valid to assign a
156 * particular value to an attribute.  For packages, this means that the 
157 * parent object to which this package element is being added must have
158 * been created with the package namespace, or that the package namespace
159 * was added to it, even if that parent is not a package object itself.
160   */ public
161 TextGlyph(long level) throws org.sbml.libsbml.SBMLConstructorException {
162    this(libsbmlJNI.new_TextGlyph__SWIG_2(level), true);
163  }
164
165  
166/**
167   * Creates a new {@link TextGlyph} with the given SBML level, versin and package
168   * version. The ids of the associated {@link GraphicalObject} and
169   * the originOfText are set to the empty string. The actual text is set
170   * to the empty string as well.
171   <p>
172   * @param level the SBML Level.
173   * @param version the Version within the SBML Level.
174   * @param pkgVersion the version of the package.
175   <p>
176   * <p>
177 * @note Attempting to add an object to an {@link SBMLDocument} having a different
178 * combination of SBML Level, Version and XML namespaces than the object
179 * itself will result in an error at the time a caller attempts to make the
180 * addition.  A parent object must have compatible Level, Version and XML
181 * namespaces.  (Strictly speaking, a parent may also have more XML
182 * namespaces than a child, but the reverse is not permitted.)  The
183 * restriction is necessary to ensure that an SBML model has a consistent
184 * overall structure.  This requires callers to manage their objects
185 * carefully, but the benefit is increased flexibility in how models can be
186 * created by permitting callers to create objects bottom-up if desired.  In
187 * situations where objects are not yet attached to parents (e.g.,
188 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
189 * libSBML determine such things as whether it is valid to assign a
190 * particular value to an attribute.  For packages, this means that the 
191 * parent object to which this package element is being added must have
192 * been created with the package namespace, or that the package namespace
193 * was added to it, even if that parent is not a package object itself.
194   */ public
195 TextGlyph() throws org.sbml.libsbml.SBMLConstructorException {
196    this(libsbmlJNI.new_TextGlyph__SWIG_3(), true);
197  }
198
199  
200/**
201   * Constructor.
202   <p>
203   * <p>
204 * The package namespaces object used in this constructor is derived from a
205 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
206 * information.  It is used to communicate the SBML Level, Version, and 
207 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
208 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
209 * package namespace object somewhere in a program once, then hand that object
210 * as needed to object constructors of that package that accept it as and
211 * argument, such as this one.
212   <p>
213   * @param layoutns the {@link LayoutPkgNamespaces} object.
214   <p>
215   * <p>
216 * @note Attempting to add an object to an {@link SBMLDocument} having a different
217 * combination of SBML Level, Version and XML namespaces than the object
218 * itself will result in an error at the time a caller attempts to make the
219 * addition.  A parent object must have compatible Level, Version and XML
220 * namespaces.  (Strictly speaking, a parent may also have more XML
221 * namespaces than a child, but the reverse is not permitted.)  The
222 * restriction is necessary to ensure that an SBML model has a consistent
223 * overall structure.  This requires callers to manage their objects
224 * carefully, but the benefit is increased flexibility in how models can be
225 * created by permitting callers to create objects bottom-up if desired.  In
226 * situations where objects are not yet attached to parents (e.g.,
227 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
228 * libSBML determine such things as whether it is valid to assign a
229 * particular value to an attribute.  For packages, this means that the 
230 * parent object to which this package element is being added must have
231 * been created with the package namespace, or that the package namespace
232 * was added to it, even if that parent is not a package object itself.
233   */ public
234 TextGlyph(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
235    this(libsbmlJNI.new_TextGlyph__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
236  }
237
238  
239/**
240   * Creates a new {@link TextGlyph}. The id is given as the first argument.
241   <p>
242   * (FOR BACKWARD COMPATIBILITY)
243   */ public
244 TextGlyph(LayoutPkgNamespaces layoutns, String id) throws org.sbml.libsbml.SBMLConstructorException {
245    this(libsbmlJNI.new_TextGlyph__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id), true);
246  }
247
248  
249/**
250   * Creates a new {@link TextGlyph}. The id is given as the first argument, the
251   * text to be displayed as the second.  All other attirbutes are set to
252   * the empty string.
253   <p>
254   * (FOR BACKWARD COMPATIBILITY)
255   */ public
256 TextGlyph(LayoutPkgNamespaces layoutns, String id, String text) throws org.sbml.libsbml.SBMLConstructorException {
257    this(libsbmlJNI.new_TextGlyph__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, text), true);
258  }
259
260  
261/**
262   * Creates a new {@link TextGlyph} from the given {@link XMLNode}
263   <p>
264   * (FOR BACKWARD COMPATIBILITY)
265   */ public
266 TextGlyph(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
267    this(libsbmlJNI.new_TextGlyph__SWIG_7(XMLNode.getCPtr(node), node, l2version), true);
268  }
269
270  
271/**
272   * Creates a new {@link TextGlyph} from the given {@link XMLNode}
273   <p>
274   * (FOR BACKWARD COMPATIBILITY)
275   */ public
276 TextGlyph(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
277    this(libsbmlJNI.new_TextGlyph__SWIG_8(XMLNode.getCPtr(node), node), true);
278  }
279
280  
281/**
282   * Copy constructor.
283   <p>
284   * @param source the instance to copy.
285   */ public
286 TextGlyph(TextGlyph source) throws org.sbml.libsbml.SBMLConstructorException {
287    this(libsbmlJNI.new_TextGlyph__SWIG_9(TextGlyph.getCPtr(source), source), true);
288  }
289
290  
291/**
292   * <p>
293 * Replaces all uses of a given <code>SIdRef</code> type attribute value with another
294 * value.
295 <p>
296 * <p>
297 * In SBML, object identifiers are of a data type called <code>SId</code>.
298 * In SBML Level&nbsp;3, an explicit data type called <code>SIdRef</code> was
299 * introduced for attribute values that refer to <code>SId</code> values; in
300 * previous Levels of SBML, this data type did not exist and attributes were
301 * simply described to as 'referring to an identifier', but the effective
302 * data type was the same as <code>SIdRef</code> in Level&nbsp;3.  These and
303 * other methods of libSBML refer to the type <code>SIdRef</code> for all
304 * Levels of SBML, even if the corresponding SBML specification did not
305 * explicitly name the data type.
306 <p>
307 * This method works by looking at all attributes and (if appropriate)
308 * mathematical formulas in MathML content, comparing the referenced
309 * identifiers to the value of <code>oldid</code>.  If any matches are found, the
310 * matching values are replaced with <code>newid</code>.  The method does <em>not</em>
311 * descend into child elements.
312 <p>
313 * @param oldid the old identifier.
314 * @param newid the new identifier.
315   */ public
316 void renameSIdRefs(String oldid, String newid) {
317    libsbmlJNI.TextGlyph_renameSIdRefs(swigCPtr, this, oldid, newid);
318  }
319
320  
321/**
322   * Returns the text to be displayed by the text glyph.
323   */ public
324 String getText() {
325    return libsbmlJNI.TextGlyph_getText(swigCPtr, this);
326  }
327
328  
329/**
330   * Sets the text to be displayed by the text glyph.
331   */ public
332 void setText(String text) {
333    libsbmlJNI.TextGlyph_setText(swigCPtr, this, text);
334  }
335
336  
337/**
338   * Returns the id of the associated graphical object.
339   */ public
340 String getGraphicalObjectId() {
341    return libsbmlJNI.TextGlyph_getGraphicalObjectId(swigCPtr, this);
342  }
343
344  
345/**
346   * Sets the id of the associated graphical object.
347   */ public
348 int setGraphicalObjectId(String id) {
349    return libsbmlJNI.TextGlyph_setGraphicalObjectId(swigCPtr, this, id);
350  }
351
352  
353/**
354   * Returns the id of the origin of text.
355   */ public
356 String getOriginOfTextId() {
357    return libsbmlJNI.TextGlyph_getOriginOfTextId(swigCPtr, this);
358  }
359
360  
361/**
362   * Sets the id of the origin of text.
363   */ public
364 int setOriginOfTextId(String orig) {
365    return libsbmlJNI.TextGlyph_setOriginOfTextId(swigCPtr, this, orig);
366  }
367
368  
369/**
370   * Returns <code>true</code> if the text is not the empty string.
371   */ public
372 boolean isSetText() {
373    return libsbmlJNI.TextGlyph_isSetText(swigCPtr, this);
374  }
375
376  
377/**
378   * Returns <code>true</code> if the id of the origin of text is not the empty string.
379   */ public
380 boolean isSetOriginOfTextId() {
381    return libsbmlJNI.TextGlyph_isSetOriginOfTextId(swigCPtr, this);
382  }
383
384  
385/**
386   * Returns <code>true</code> if the id of the associated graphical object is not the
387   * empty string.
388   */ public
389 boolean isSetGraphicalObjectId() {
390    return libsbmlJNI.TextGlyph_isSetGraphicalObjectId(swigCPtr, this);
391  }
392
393  
394/**
395   * Calls initDefaults from {@link GraphicalObject}.
396   */ public
397 void initDefaults() {
398    libsbmlJNI.TextGlyph_initDefaults(swigCPtr, this);
399  }
400
401  
402/**
403   * Returns the XML element name of
404   * this SBML object.
405   <p>
406   * @return the string of the name of this element.
407   */ public
408 String getElementName() {
409    return libsbmlJNI.TextGlyph_getElementName(swigCPtr, this);
410  }
411
412  
413/**
414   * Creates and returns a deep copy of this {@link TextGlyph}.
415   <p>
416   * @return a (deep) copy of this {@link TextGlyph}.
417   */ public
418 TextGlyph cloneObject() {
419    long cPtr = libsbmlJNI.TextGlyph_cloneObject(swigCPtr, this);
420    return (cPtr == 0) ? null : new TextGlyph(cPtr, true);
421  }
422
423  
424/**
425   * Returns the libSBML type code of this object instance.
426   <p>
427   * <p>
428 * LibSBML attaches an identifying code to every kind of SBML object.  These
429 * are integer constants known as <em>SBML type codes</em>.  The names of all
430 * the codes begin with the characters <code>SBML_</code>.
431 * In the Java language interface for libSBML, the
432 * type codes are defined as static integer constants in the interface class
433 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
434 * package plug-ins may use overlapping type codes; to identify the package
435 * to which a given object belongs, call the <code>getPackageName()</code>
436 * method on the object.
437   <p>
438   * @return the SBML type code for this object:
439   * {@link libsbmlConstants#SBML_LAYOUT_TEXTGLYPH SBML_LAYOUT_TEXTGLYPH}.
440   <p>
441   * <p>
442 * @warning <span class='warning'>The specific integer values of the possible
443 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
444 * packages,  To fully identify the correct code, <strong>it is necessary to
445 * invoke both getTypeCode() and getPackageName()</strong>.</span>
446   <p>
447   * @see #getElementName()
448   * @see #getPackageName()
449   */ public
450 int getTypeCode() {
451    return libsbmlJNI.TextGlyph_getTypeCode(swigCPtr, this);
452  }
453
454  
455/**
456    * Creates an {@link XMLNode} object from this.
457    */ public
458 XMLNode toXML() {
459    return new XMLNode(libsbmlJNI.TextGlyph_toXML(swigCPtr, this), true);
460  }
461
462}