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 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   */ public
085 Curve(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
086    this(libsbmlJNI.new_Curve__SWIG_0(level, version, pkgVersion), true);
087  }
088
089  
090/**
091   * Creates a curve with an empty list of segments.
092   */ public
093 Curve(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
094    this(libsbmlJNI.new_Curve__SWIG_1(level, version), true);
095  }
096
097  
098/**
099   * Creates a curve with an empty list of segments.
100   */ public
101 Curve(long level) throws org.sbml.libsbml.SBMLConstructorException {
102    this(libsbmlJNI.new_Curve__SWIG_2(level), true);
103  }
104
105  
106/**
107   * Creates a curve with an empty list of segments.
108   */ public
109 Curve() throws org.sbml.libsbml.SBMLConstructorException {
110    this(libsbmlJNI.new_Curve__SWIG_3(), true);
111  }
112
113  
114/**
115   * Creates a new {@link Curve} with the given {@link LayoutPkgNamespaces} object.
116   */ public
117 Curve(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
118    this(libsbmlJNI.new_Curve__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
119  }
120
121  
122/**
123   * Creates a new {@link Curve} from the given {@link XMLNode}
124   */ public
125 Curve(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
126    this(libsbmlJNI.new_Curve__SWIG_5(XMLNode.getCPtr(node), node, l2version), true);
127  }
128
129  
130/**
131   * Creates a new {@link Curve} from the given {@link XMLNode}
132   */ public
133 Curve(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
134    this(libsbmlJNI.new_Curve__SWIG_6(XMLNode.getCPtr(node), node), true);
135  }
136
137  
138/**
139   * Copy constructor.
140   */ public
141 Curve(Curve source) throws org.sbml.libsbml.SBMLConstructorException {
142    this(libsbmlJNI.new_Curve__SWIG_7(Curve.getCPtr(source), source), true);
143  }
144
145  
146/**
147   * Does nothing since no defaults are defined for {@link Curve}.
148   */ public
149 void initDefaults() {
150    libsbmlJNI.Curve_initDefaults(swigCPtr, this);
151  }
152
153  
154/**
155   * Returns a refernce to the {@link ListOf} object That holds all the curve
156   * segments.
157   */ public
158 ListOfLineSegments getListOfCurveSegments() {
159    long cPtr = libsbmlJNI.Curve_getListOfCurveSegments(swigCPtr, this);
160    return (cPtr == 0) ? null : new ListOfLineSegments(cPtr, false);
161  }
162
163  
164/**
165   * Returns a pointer to the curve segment with the given index.
166   * If the index is invalid, <code>null</code> is returned.
167   */ public
168 LineSegment getCurveSegment(long index) {
169    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.Curve_getCurveSegment__SWIG_0(swigCPtr, this, index), false);
170}
171
172  
173/**
174   * Adds a new CurveSegment to the end of the list.
175   */ public
176 void addCurveSegment(LineSegment segment) {
177    libsbmlJNI.Curve_addCurveSegment(swigCPtr, this, LineSegment.getCPtr(segment), segment);
178  }
179
180  
181/**
182   * Returns the number of curve segments.
183   */ public
184 long getNumCurveSegments() {
185    return libsbmlJNI.Curve_getNumCurveSegments(swigCPtr, this);
186  }
187
188  
189/**
190   * Creates a new {@link LineSegment} and adds it to the end of the list.  A
191   * reference to the new {@link LineSegment} object is returned.
192   */ public
193 LineSegment createLineSegment() {
194    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.Curve_createLineSegment(swigCPtr, this), false);
195}
196
197  
198/**
199   * Creates a new {@link CubicBezier} and adds it to the end of the list.  A
200   * reference to the new {@link CubicBezier} object is returned.
201   */ public
202 CubicBezier createCubicBezier() {
203    long cPtr = libsbmlJNI.Curve_createCubicBezier(swigCPtr, this);
204    return (cPtr == 0) ? null : new CubicBezier(cPtr, false);
205  }
206
207  
208/**
209   * Returns the XML element name of
210   * this SBML object.
211   <p>
212   * @return the string of the name of this element
213   */ public
214 String getElementName() {
215    return libsbmlJNI.Curve_getElementName(swigCPtr, this);
216  }
217
218  
219/**
220   * Creates and returns a deep copy of this {@link Curve}.
221   <p>
222   * @return a (deep) copy of this {@link Curve}.
223   */ public
224 Curve cloneObject() {
225    long cPtr = libsbmlJNI.Curve_cloneObject(swigCPtr, this);
226    return (cPtr == 0) ? null : new Curve(cPtr, true);
227  }
228
229  
230/**
231   * Returns the libSBML type code of this object instance.
232   <p>
233   * <p>
234 * LibSBML attaches an identifying code to every kind of SBML object.  These
235 * are integer constants known as <em>SBML type codes</em>.  The names of all
236 * the codes begin with the characters <code>SBML_</code>.
237 * In the Java language interface for libSBML, the
238 * type codes are defined as static integer constants in the interface class
239 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
240 * package plug-ins may use overlapping type codes; to identify the package
241 * to which a given object belongs, call the <code>getPackageName()</code>
242 * method on the object.
243   <p>
244   * @return the SBML type code for this object:
245   * {@link libsbmlConstants#SBML_LAYOUT_CURVE SBML_LAYOUT_CURVE}
246   <p>
247   * <p>
248 * @warning <span class='warning'>The specific integer values of the possible
249 * type codes may be reused by different Level&nbsp;3 package plug-ins.
250 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
251 * both getTypeCode() and getPackageName()</strong>.</span>
252   <p>
253   * @see #getElementName()
254   * @see #getPackageName()
255   */ public
256 int getTypeCode() {
257    return libsbmlJNI.Curve_getTypeCode(swigCPtr, this);
258  }
259
260  
261/**
262    * Creates an {@link XMLNode} object from this.
263    */ public
264 XMLNode toXML() {
265    return new XMLNode(libsbmlJNI.Curve_toXML(swigCPtr, this), true);
266  }
267
268  public void connectToChild() {
269    libsbmlJNI.Curve_connectToChild(swigCPtr, this);
270  }
271
272  
273/** * @internal */ public
274 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
275    libsbmlJNI.Curve_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
276  }
277
278}