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 * implementation of the {@link Curve} concept from the SBML render extension
013 <p>
014 * The curve concept in the SBML render extension is similar to the curves in the SBML layout.
015 * Each curve consists of a number of either straight line segments or cubic bezier elements.
016 * The two element types can also by mixed in a single curve object.
017 <p>
018 * In contrast to layout curves, render curves can not have gaps and the individual coordinates of the 
019 * curve elements can be specified as a combination of absolute and relative values.
020 <p>
021 * Another difference to layout curves is the fact that render curves can specify decorations to be applied
022 * to the start and/or the end of the curve (
023 * Since {@link RenderCurve} is derived from {@link GraphicalPrimitive1D}, it inherits all its attributes and methods. 
024 <p>
025   * @see LineEnding).
026 */
027
028public class RenderCurve extends GraphicalPrimitive1D {
029   private long swigCPtr;
030
031   protected RenderCurve(long cPtr, boolean cMemoryOwn)
032   {
033     super(libsbmlJNI.RenderCurve_SWIGUpcast(cPtr), cMemoryOwn);
034     swigCPtr = cPtr;
035   }
036
037   protected static long getCPtr(RenderCurve obj)
038   {
039     return (obj == null) ? 0 : obj.swigCPtr;
040   }
041
042   protected static long getCPtrAndDisown (RenderCurve obj)
043   {
044     long ptr = 0;
045
046     if (obj != null)
047     {
048       ptr             = obj.swigCPtr;
049       obj.swigCMemOwn = false;
050     }
051
052     return ptr;
053   }
054
055  protected void finalize() {
056    delete();
057  }
058
059  public synchronized void delete() {
060    if (swigCPtr != 0) {
061      if (swigCMemOwn) {
062        swigCMemOwn = false;
063        libsbmlJNI.delete_RenderCurve(swigCPtr);
064      }
065      swigCPtr = 0;
066    }
067    super.delete();
068  }
069
070  
071/**
072   * Creates a new {@link RenderCurve} object with the given SBML level
073   * and SBML version.
074   <p>
075   * @param level SBML level of the new object
076   * @param level SBML version of the new object
077   */ public
078 RenderCurve(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
079    this(libsbmlJNI.new_RenderCurve__SWIG_0(level, version, pkgVersion), true);
080  }
081
082  
083/**
084   * Creates a new {@link RenderCurve} object with the given SBML level
085   * and SBML version.
086   <p>
087   * @param level SBML level of the new object
088   * @param level SBML version of the new object
089   */ public
090 RenderCurve(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
091    this(libsbmlJNI.new_RenderCurve__SWIG_1(level, version), true);
092  }
093
094  
095/**
096   * Creates a new {@link RenderCurve} object with the given SBML level
097   * and SBML version.
098   <p>
099   * @param level SBML level of the new object
100   * @param level SBML version of the new object
101   */ public
102 RenderCurve(long level) throws org.sbml.libsbml.SBMLConstructorException {
103    this(libsbmlJNI.new_RenderCurve__SWIG_2(level), true);
104  }
105
106  
107/**
108   * Creates a new {@link RenderCurve} object with the given SBML level
109   * and SBML version.
110   <p>
111   * @param level SBML level of the new object
112   * @param level SBML version of the new object
113   */ public
114 RenderCurve() throws org.sbml.libsbml.SBMLConstructorException {
115    this(libsbmlJNI.new_RenderCurve__SWIG_3(), true);
116  }
117
118  
119/**
120   * Creates a new {@link RenderCurve} object with the given {@link SBMLNamespaces}.
121   <p>
122   * @param sbmlns The SBML namespace for the object.
123   */ public
124 RenderCurve(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
125    this(libsbmlJNI.new_RenderCurve__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
126  }
127
128  
129/**
130   * Creates a new {@link RenderCurve} object from the given {@link XMLNode} object.
131   * The {@link XMLNode} object has to contain a valid XML representation of a 
132   * {@link RenderCurve} object as defined in the render extension specification.
133   * This method is normally called when render information is read from a file and 
134   * should normally not have to be called explicitly.
135   <p>
136   * @param node the {@link XMLNode} object reference that describes the {@link RenderCurve}
137   * object to be instantiated.
138   */ public
139 RenderCurve(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
140    this(libsbmlJNI.new_RenderCurve__SWIG_5(XMLNode.getCPtr(node), node, l2version), true);
141  }
142
143  
144/**
145   * Creates a new {@link RenderCurve} object from the given {@link XMLNode} object.
146   * The {@link XMLNode} object has to contain a valid XML representation of a 
147   * {@link RenderCurve} object as defined in the render extension specification.
148   * This method is normally called when render information is read from a file and 
149   * should normally not have to be called explicitly.
150   <p>
151   * @param node the {@link XMLNode} object reference that describes the {@link RenderCurve}
152   * object to be instantiated.
153   */ public
154 RenderCurve(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
155    this(libsbmlJNI.new_RenderCurve__SWIG_6(XMLNode.getCPtr(node), node), true);
156  }
157
158  
159/**
160   * Instantiates an empty curve object with the given <code>id</code>.
161   * The decorations  are unset and there are no curve elements.
162   <p>
163   * This constructor is deprecated. The new libsbml API only has
164   * constructors which take the SBML level and version or one that takes
165   * an {@link SBMLNamespaces} object.
166   */ public
167 RenderCurve(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException {
168    this(libsbmlJNI.new_RenderCurve__SWIG_7(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true);
169  }
170
171  
172/**
173   * Sets the id of the start head.
174   <p>
175   * @param The id of a {@link LineEnding} object to be applied to the start of the curve.
176   */ public
177 void setStartHead(String startHead) {
178    libsbmlJNI.RenderCurve_setStartHead(swigCPtr, this, startHead);
179  }
180
181  
182/**
183   * Sets the id of the end head.
184   <p>
185   * @param The id of a {@link LineEnding} object to be applied to the end of the curve.
186   */ public
187 void setEndHead(String endHead) {
188    libsbmlJNI.RenderCurve_setEndHead(swigCPtr, this, endHead);
189  }
190
191  
192/**
193   * Returns the id of the {@link LineEnding} object to be applied to the start of the curve.
194   <p>
195   * @return id of the {@link LineEnding} for the start of the curve.
196   */ public
197 String getStartHead() {
198    return libsbmlJNI.RenderCurve_getStartHead(swigCPtr, this);
199  }
200
201  
202/**
203   * Returns the id of the {@link LineEnding} object to be applied to the end of the curve.
204   <p>
205   * @return id of the {@link LineEnding} for the end of the curve.
206   */ public
207 String getEndHead() {
208    return libsbmlJNI.RenderCurve_getEndHead(swigCPtr, this);
209  }
210
211  
212/**
213   * Returns the number of curve segments.
214   <p>
215   * @return number of elements in the curve.
216   */ public
217 long getNumElements() {
218    return libsbmlJNI.RenderCurve_getNumElements(swigCPtr, this);
219  }
220
221  
222/**
223   * Creates a new bezier element.
224   * The element is added to and owned by the curve.
225   <p>
226   * @return The newly created {@link RenderCubicBezier} object.
227   */ public
228 RenderCubicBezier createCubicBezier() {
229    long cPtr = libsbmlJNI.RenderCurve_createCubicBezier(swigCPtr, this);
230    return (cPtr == 0) ? null : new RenderCubicBezier(cPtr, false);
231  }
232
233  
234/**
235   * Creates a new point element.
236   * The element is added to and owned by the curve.
237   <p>
238   * @return The newly created {@link RenderCubicBezier} object.
239   */ public
240 RenderPoint createPoint() {
241  return (RenderPoint) libsbml.DowncastSBase(libsbmlJNI.RenderCurve_createPoint(swigCPtr, this), false);
242}
243
244  
245/**
246   * Returns a  pointer to the curve segment with the given index or null if
247   * the id is invalid.
248   <p>
249   * @param index the index of the curve element to be returned
250   <p>
251   * @return a  pointer to the curve element with the given index or null 
252   * if the index was out of bounds.
253   */ public
254 RenderPoint getElement(long index) {
255  return (RenderPoint) libsbml.DowncastSBase(libsbmlJNI.RenderCurve_getElement__SWIG_0(swigCPtr, this, index), false);
256}
257
258  
259/**
260   * Returns a pointer to the curve segment with the given index or null if
261   * the id is invalid.
262   <p>
263   * This method call is deprecated, please use getElement instead.
264   <p>
265   * @param index the index of the curve element to be returned
266   <p>
267   * @return a pointer to the curve element with the given index or null 
268   * if the index was out of bounds.
269   */ public
270 RenderPoint getCurveElement(long index) {
271  return (RenderPoint) libsbml.DowncastSBase(libsbmlJNI.RenderCurve_getCurveElement__SWIG_0(swigCPtr, this, index), false);
272}
273
274  
275/**
276   * Adds a copy of the given curve segment to the end of the list of
277   * curve segments.
278   <p>
279   * @param cs pointer to the {@link RenderPoint} object to be added to the end of the curve elements list.
280   <p>
281   * @return integer value indicating success/failure of the
282   * function.   The possible values
283   * returned by this function are:
284   * <ul>
285   * <li> LIBSBML_OPERATION_SUCCESS
286   * <li> LIBSBML_LEVEL_MISMATCH
287   * <li> LIBSBML_VERSION_MISMATCH
288   * <li> LIBSBML_OPERATION_FAILED
289   *
290   * </ul> <p>
291   * @note This method should be used with some caution.  The fact that
292   * this method <em>copies</em> the object passed to it means that the caller
293   * will be left holding a physically different object instance than the
294   * one contained in this {@link RenderCurve}.  Changes made to the original object
295   * instance (such as resetting attribute values) will <em>not affect the
296   * instance in the {@link RenderCurve}</em>.  In addition, the caller should make
297   * sure to free the original object if it is no longer being used, or
298   * else a memory leak will result.  Please see {@link RenderCurve#createPoint()}
299   * or {@link RenderCurve#createCubicBezier()}
300   * for methods that do not lead to these issues.
301   <p>
302   * @see #createPoint()
303   * @see #createCubicBezier()
304   */ public
305 int addElement(RenderPoint cs) {
306    return libsbmlJNI.RenderCurve_addElement(swigCPtr, this, RenderPoint.getCPtr(cs), cs);
307  }
308
309  
310/**
311   * Removes the curve segment with the given index.
312   * If the index is valid, a pointer to the removed element is returned
313   * and the caller is responsible for deleting the object.
314   * If the index is not valid, <code>null</code> is returned.
315   <p>
316   * @param i index of element to be removed.
317   <p>
318   * @return pointer to removed element.
319   */ public
320 RenderPoint removeElement(long i) {
321  return (RenderPoint) libsbml.DowncastSBase(libsbmlJNI.RenderCurve_removeElement(swigCPtr, this, i), false);
322}
323
324  
325/**
326   * Returns a  pointer to the list of curve segments.
327   <p>
328   * @return  pointer to the {@link ListOfCurveElements} object for the {@link RenderCurve}.
329   */ public
330 ListOfCurveElements getListOfElements() {
331    long cPtr = libsbmlJNI.RenderCurve_getListOfElements__SWIG_0(swigCPtr, this);
332    return (cPtr == 0) ? null : new ListOfCurveElements(cPtr, false);
333  }
334
335  
336/**
337   * Renames all the <code>SIdRef</code> attributes on this element, including any
338   * found in MathML content (if such exists).
339   <p>
340   * This method works by looking at all attributes and (if appropriate)
341   * mathematical formulas, comparing the identifiers to the value of @p
342   * oldid.  If any matches are found, the matching identifiers are replaced
343   * with <code>newid</code>.  The method does <em>not</em> descend into child elements.
344   <p>
345   * @param oldid the old identifier
346   * @param newid the new identifier
347   */ public
348 void renameSIdRefs(String oldid, String newid) {
349    libsbmlJNI.RenderCurve_renameSIdRefs(swigCPtr, this, oldid, newid);
350  }
351
352  
353/**
354  * Creates and returns a deep copy of the {@link RenderCurve} object.
355  <p>
356  * @return a (deep) copy of this {@link RenderCurve}
357  */ public
358 RenderCurve cloneObject() {
359    long cPtr = libsbmlJNI.RenderCurve_cloneObject(swigCPtr, this);
360    return (cPtr == 0) ? null : new RenderCurve(cPtr, true);
361  }
362
363  
364/**
365  * Returns the XML element name of this object, which for
366  * {@link RenderCurve}, is always <code>'curve'.</code>
367  <p>
368  * @return the name of this element, i.e., <code>'curve'.</code>
369  */ public
370 String getElementName() {
371    return libsbmlJNI.RenderCurve_getElementName(swigCPtr, this);
372  }
373
374  
375/**
376  * Returns the libSBML type code for this SBML object.
377  <p>
378  * LibSBML attaches an
379  * identifying code to every kind of SBML object.  These are known as
380  * <em>SBML type codes</em>.  In other languages, the set of type codes
381  * is stored in an enumeration; in the Java language interface for
382  * libSBML, the type codes are defined as static integer constants in
383  * interface class {@link libsbmlConstants}.  The names of the type codes
384  * all begin with the characters <code>SBML_.</code> 
385  <p>
386  * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
387  <p>
388  * @see #getElementName()
389  */ public
390 int getTypeCode() {
391    return libsbmlJNI.RenderCurve_getTypeCode(swigCPtr, this);
392  }
393
394  
395/**
396  * Returns true if the start head is set or false otherwise.
397  * The start decoration is considered set if the string is not empty and if
398  * it is not the string 'none'
399  <p>
400  * @return true is the start decoration id is set
401  */ public
402 boolean isSetStartHead() {
403    return libsbmlJNI.RenderCurve_isSetStartHead(swigCPtr, this);
404  }
405
406  
407/**
408  * Returns true if the end head is set or false otherwise.
409  * The end decoration is considered set if the string is not empty and if
410  * it is not the string 'none'
411  <p>
412  * @return true is the end decoration id is set
413  */ public
414 boolean isSetEndHead() {
415    return libsbmlJNI.RenderCurve_isSetEndHead(swigCPtr, this);
416  }
417
418  
419/**
420  * Creates an {@link XMLNode} object from this {@link RenderCurve} object.
421  <p>
422  * @return the {@link XMLNode} with the XML representation for the 
423  * {@link RenderCurve} object.
424  */ public
425 XMLNode toXML() {
426    return new XMLNode(libsbmlJNI.RenderCurve_toXML(swigCPtr, this), true);
427  }
428
429  public void connectToChild() {
430    libsbmlJNI.RenderCurve_connectToChild(swigCPtr, this);
431  }
432
433  
434/** * @internal */ public
435 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
436    libsbmlJNI.RenderCurve_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
437  }
438
439}