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 curve connecting elements in a diagram.
015 <p>
016 * The {@link Curve} class describes how to connect elements in a diagram defined
017 * with the use of the &ldquo;layout&rdquo; package. A curve is fully
018 * specified by a mandatory listOfCurveSegments element and is used in four
019 * places in the &ldquo;layout&rdquo; package:
020 <p>
021 * <ul>
022 * <li> SpeciesReferenceGlyph: Here it describes a curve from/to the center
023 * piece of the parent {@link ReactionGlyph} to/from the {@link SpeciesGlyph} it represents.
024 <p>
025 * <li> ReactionGlyph: Here it describes a curve for the center piece of a
026 * reaction.
027 <p>
028 * <li> ReferenceGlyph: Here it describes a curve from/to the center piece of
029 * the parent {@link GeneralGlyph} to/from the glyph it represents.
030 <p>
031 * <li> GeneralGlyph: Here it describes a curve for the center piece of an
032 * additional relationship.
033 *
034 * </ul> <p>
035 * In the text above, the term 'center piece' refers to either the {@link Curve}
036 * element of a {@link ReactionGlyph}, or its {@link BoundingBox}.
037 */
038
039public class Curve extends SBase {
040   private long swigCPtr;
041
042   protected Curve(long cPtr, boolean cMemoryOwn)
043   {
044     super(libsbmlJNI.Curve_SWIGUpcast(cPtr), cMemoryOwn);
045     swigCPtr = cPtr;
046   }
047
048   protected static long getCPtr(Curve obj)
049   {
050     return (obj == null) ? 0 : obj.swigCPtr;
051   }
052
053   protected static long getCPtrAndDisown (Curve obj)
054   {
055     long ptr = 0;
056
057     if (obj != null)
058     {
059       ptr             = obj.swigCPtr;
060       obj.swigCMemOwn = false;
061     }
062
063     return ptr;
064   }
065
066  protected void finalize() {
067    delete();
068  }
069
070  public synchronized void delete() {
071    if (swigCPtr != 0) {
072      if (swigCMemOwn) {
073        swigCMemOwn = false;
074        libsbmlJNI.delete_Curve(swigCPtr);
075      }
076      swigCPtr = 0;
077    }
078    super.delete();
079  }
080
081  
082/**
083   * Creates a curve with an empty list of segments.
084   <p>
085   * @param level the SBML Level.
086   * @param version the Version within the SBML Level.
087   * @param pkgVersion the version of the package.
088   <p>
089   * <p>
090 * @note Attempting to add an object to an {@link SBMLDocument} having a different
091 * combination of SBML Level, Version and XML namespaces than the object
092 * itself will result in an error at the time a caller attempts to make the
093 * addition.  A parent object must have compatible Level, Version and XML
094 * namespaces.  (Strictly speaking, a parent may also have more XML
095 * namespaces than a child, but the reverse is not permitted.)  The
096 * restriction is necessary to ensure that an SBML model has a consistent
097 * overall structure.  This requires callers to manage their objects
098 * carefully, but the benefit is increased flexibility in how models can be
099 * created by permitting callers to create objects bottom-up if desired.  In
100 * situations where objects are not yet attached to parents (e.g.,
101 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
102 * libSBML determine such things as whether it is valid to assign a
103 * particular value to an attribute.  For packages, this means that the 
104 * parent object to which this package element is being added must have
105 * been created with the package namespace, or that the package namespace
106 * was added to it, even if that parent is not a package object itself.
107   */ public
108 Curve(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
109    this(libsbmlJNI.new_Curve__SWIG_0(level, version, pkgVersion), true);
110  }
111
112  
113/**
114   * Creates a curve with an empty list of segments.
115   <p>
116   * @param level the SBML Level.
117   * @param version the Version within the SBML Level.
118   * @param pkgVersion the version of the package.
119   <p>
120   * <p>
121 * @note Attempting to add an object to an {@link SBMLDocument} having a different
122 * combination of SBML Level, Version and XML namespaces than the object
123 * itself will result in an error at the time a caller attempts to make the
124 * addition.  A parent object must have compatible Level, Version and XML
125 * namespaces.  (Strictly speaking, a parent may also have more XML
126 * namespaces than a child, but the reverse is not permitted.)  The
127 * restriction is necessary to ensure that an SBML model has a consistent
128 * overall structure.  This requires callers to manage their objects
129 * carefully, but the benefit is increased flexibility in how models can be
130 * created by permitting callers to create objects bottom-up if desired.  In
131 * situations where objects are not yet attached to parents (e.g.,
132 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
133 * libSBML determine such things as whether it is valid to assign a
134 * particular value to an attribute.  For packages, this means that the 
135 * parent object to which this package element is being added must have
136 * been created with the package namespace, or that the package namespace
137 * was added to it, even if that parent is not a package object itself.
138   */ public
139 Curve(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
140    this(libsbmlJNI.new_Curve__SWIG_1(level, version), true);
141  }
142
143  
144/**
145   * Creates a curve with an empty list of segments.
146   <p>
147   * @param level the SBML Level.
148   * @param version the Version within the SBML Level.
149   * @param pkgVersion the version of the package.
150   <p>
151   * <p>
152 * @note Attempting to add an object to an {@link SBMLDocument} having a different
153 * combination of SBML Level, Version and XML namespaces than the object
154 * itself will result in an error at the time a caller attempts to make the
155 * addition.  A parent object must have compatible Level, Version and XML
156 * namespaces.  (Strictly speaking, a parent may also have more XML
157 * namespaces than a child, but the reverse is not permitted.)  The
158 * restriction is necessary to ensure that an SBML model has a consistent
159 * overall structure.  This requires callers to manage their objects
160 * carefully, but the benefit is increased flexibility in how models can be
161 * created by permitting callers to create objects bottom-up if desired.  In
162 * situations where objects are not yet attached to parents (e.g.,
163 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
164 * libSBML determine such things as whether it is valid to assign a
165 * particular value to an attribute.  For packages, this means that the 
166 * parent object to which this package element is being added must have
167 * been created with the package namespace, or that the package namespace
168 * was added to it, even if that parent is not a package object itself.
169   */ public
170 Curve(long level) throws org.sbml.libsbml.SBMLConstructorException {
171    this(libsbmlJNI.new_Curve__SWIG_2(level), true);
172  }
173
174  
175/**
176   * Creates a curve with an empty list of segments.
177   <p>
178   * @param level the SBML Level.
179   * @param version the Version within the SBML Level.
180   * @param pkgVersion the version of the package.
181   <p>
182   * <p>
183 * @note Attempting to add an object to an {@link SBMLDocument} having a different
184 * combination of SBML Level, Version and XML namespaces than the object
185 * itself will result in an error at the time a caller attempts to make the
186 * addition.  A parent object must have compatible Level, Version and XML
187 * namespaces.  (Strictly speaking, a parent may also have more XML
188 * namespaces than a child, but the reverse is not permitted.)  The
189 * restriction is necessary to ensure that an SBML model has a consistent
190 * overall structure.  This requires callers to manage their objects
191 * carefully, but the benefit is increased flexibility in how models can be
192 * created by permitting callers to create objects bottom-up if desired.  In
193 * situations where objects are not yet attached to parents (e.g.,
194 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
195 * libSBML determine such things as whether it is valid to assign a
196 * particular value to an attribute.  For packages, this means that the 
197 * parent object to which this package element is being added must have
198 * been created with the package namespace, or that the package namespace
199 * was added to it, even if that parent is not a package object itself.
200   */ public
201 Curve() throws org.sbml.libsbml.SBMLConstructorException {
202    this(libsbmlJNI.new_Curve__SWIG_3(), true);
203  }
204
205  
206/**
207   * Creates a new {@link Curve} with the given {@link LayoutPkgNamespaces} object.
208   <p>
209   * <p>
210 * The package namespaces object used in this constructor is derived from a
211 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces
212 * information.  It is used to communicate the SBML Level, Version, and 
213 * package version and name information used in addition to SBML Level&nbsp;3 Core.  A
214 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an
215 * package namespace object somewhere in a program once, then hand that object
216 * as needed to object constructors of that package that accept it as and
217 * argument, such as this one.
218   <p>
219   * @param layoutns the {@link LayoutPkgNamespaces} object.
220   <p>
221   * <p>
222 * @note Attempting to add an object to an {@link SBMLDocument} having a different
223 * combination of SBML Level, Version and XML namespaces than the object
224 * itself will result in an error at the time a caller attempts to make the
225 * addition.  A parent object must have compatible Level, Version and XML
226 * namespaces.  (Strictly speaking, a parent may also have more XML
227 * namespaces than a child, but the reverse is not permitted.)  The
228 * restriction is necessary to ensure that an SBML model has a consistent
229 * overall structure.  This requires callers to manage their objects
230 * carefully, but the benefit is increased flexibility in how models can be
231 * created by permitting callers to create objects bottom-up if desired.  In
232 * situations where objects are not yet attached to parents (e.g.,
233 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help
234 * libSBML determine such things as whether it is valid to assign a
235 * particular value to an attribute.  For packages, this means that the 
236 * parent object to which this package element is being added must have
237 * been created with the package namespace, or that the package namespace
238 * was added to it, even if that parent is not a package object itself.
239   */ public
240 Curve(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
241    this(libsbmlJNI.new_Curve__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
242  }
243
244  
245/**
246   * Creates a new {@link Curve} from the given {@link XMLNode}
247   */ public
248 Curve(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
249    this(libsbmlJNI.new_Curve__SWIG_5(XMLNode.getCPtr(node), node, l2version), true);
250  }
251
252  
253/**
254   * Creates a new {@link Curve} from the given {@link XMLNode}
255   */ public
256 Curve(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
257    this(libsbmlJNI.new_Curve__SWIG_6(XMLNode.getCPtr(node), node), true);
258  }
259
260  
261/**
262   * Copy constructor.
263   <p>
264   * @param source the instance to copy.
265   */ public
266 Curve(Curve source) throws org.sbml.libsbml.SBMLConstructorException {
267    this(libsbmlJNI.new_Curve__SWIG_7(Curve.getCPtr(source), source), true);
268  }
269
270  
271/**
272   * Does nothing since no defaults are defined for {@link Curve}.
273   */ public
274 void initDefaults() {
275    libsbmlJNI.Curve_initDefaults(swigCPtr, this);
276  }
277
278  
279/**
280   * Returns a refernce to the {@link ListOf} object That holds all the curve
281   * segments.
282   <p>
283   * @return the {@link ListOfLineSegments} of this {@link Curve} defined as the child 
284   * listOfCurveSegments.  Will never return null; the listOfCurveSegments 
285   * is always created, even if empty.
286   */ public
287 ListOfLineSegments getListOfCurveSegments() {
288    long cPtr = libsbmlJNI.Curve_getListOfCurveSegments(swigCPtr, this);
289    return (cPtr == 0) ? null : new ListOfLineSegments(cPtr, false);
290  }
291
292  
293/**
294   * Returns a pointer to the curve segment with the given index.
295   * If the index is invalid, <code>null</code> is returned.
296   <p>
297   * @param index the index value of the curve segment to return.
298   <p>
299   * @return the {@link LineSegment} representing the child 'curveSegment'
300   * with the appropriate <code>index</code>, or null if no such {@link LineSegment}
301   * exists.
302   */ public
303 LineSegment getCurveSegment(long index) {
304    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.Curve_getCurveSegment__SWIG_0(swigCPtr, this, index), false);
305}
306
307  
308/**
309   * Adds a copy of the given {@link LineSegment} to the end of the 
310   * {@link ListOfLineSegments}.
311   <p>
312   * @param segment the {@link LineSegment} to add as a new child 
313   * 'curveSegment' of the listOfCurveSegments.
314   */ public
315 int addCurveSegment(LineSegment segment) {
316    return libsbmlJNI.Curve_addCurveSegment(swigCPtr, this, LineSegment.getCPtr(segment), segment);
317  }
318
319  
320/**
321   * Returns the number of curve segments.
322   <p>
323   * @return the number of 'curveSegment' children of this {@link Curve}.
324   */ public
325 long getNumCurveSegments() {
326    return libsbmlJNI.Curve_getNumCurveSegments(swigCPtr, this);
327  }
328
329  
330/**
331   * Creates a new {@link LineSegment} and adds it to the end of the list.  A
332   * reference to the new {@link LineSegment} object is returned.
333   <p>
334   * @return the {@link LineSegment} created as a new child 'curveSegment'
335   * of this {@link Curve}.
336   */ public
337 LineSegment createLineSegment() {
338    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.Curve_createLineSegment(swigCPtr, this), false);
339}
340
341  
342/**
343   * Creates a new {@link CubicBezier} and adds it to the end of the list.  A
344   * reference to the new {@link CubicBezier} object is returned.
345   <p>
346   * @return the {@link CubicBezier} created as a new child 'curveSegment' of 
347   * this {@link Curve}.
348   */ public
349 CubicBezier createCubicBezier() {
350    long cPtr = libsbmlJNI.Curve_createCubicBezier(swigCPtr, this);
351    return (cPtr == 0) ? null : new CubicBezier(cPtr, false);
352  }
353
354  
355/**
356   * Returns the XML element name of
357   * this SBML object.
358   <p>
359   * @return the string of the name of this element.
360   */ public
361 String getElementName() {
362    return libsbmlJNI.Curve_getElementName(swigCPtr, this);
363  }
364
365  
366/**
367   * Creates and returns a deep copy of this {@link Curve}.
368   <p>
369   * @return a (deep) copy of this {@link Curve}.
370   */ public
371 Curve cloneObject() {
372    long cPtr = libsbmlJNI.Curve_cloneObject(swigCPtr, this);
373    return (cPtr == 0) ? null : new Curve(cPtr, true);
374  }
375
376  
377/**
378   * Returns the libSBML type code of this object instance.
379   <p>
380   * <p>
381 * LibSBML attaches an identifying code to every kind of SBML object.  These
382 * are integer constants known as <em>SBML type codes</em>.  The names of all
383 * the codes begin with the characters <code>SBML_</code>.
384 * In the Java language interface for libSBML, the
385 * type codes are defined as static integer constants in the interface class
386 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
387 * package plug-ins may use overlapping type codes; to identify the package
388 * to which a given object belongs, call the <code>getPackageName()</code>
389 * method on the object.
390   <p>
391   * @return the SBML type code for this object:
392   * {@link libsbmlConstants#SBML_LAYOUT_CURVE SBML_LAYOUT_CURVE}.
393   <p>
394   * <p>
395 * @warning <span class='warning'>The specific integer values of the possible
396 * type codes may be reused by different libSBML plug-ins for SBML Level&nbsp;3.
397 * packages,  To fully identify the correct code, <strong>it is necessary to
398 * invoke both getTypeCode() and getPackageName()</strong>.</span>
399   <p>
400   * @see #getElementName()
401   * @see #getPackageName()
402   */ public
403 int getTypeCode() {
404    return libsbmlJNI.Curve_getTypeCode(swigCPtr, this);
405  }
406
407  
408/**
409    * Creates an {@link XMLNode} object from this.
410    */ public
411 XMLNode toXML() {
412    return new XMLNode(libsbmlJNI.Curve_toXML(swigCPtr, this), true);
413  }
414
415  public void connectToChild() {
416    libsbmlJNI.Curve_connectToChild(swigCPtr, this);
417  }
418
419  
420/** * @internal */ public
421 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
422    libsbmlJNI.Curve_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
423  }
424
425}