001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.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 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span> 013 014 The {@link Curve} class describes how to connect elements in a 015 * diagram defined with the use of the “layout” package. A curve 016 * is fully specified by a mandatory listOfCurveSegments element and is used 017 * in four places in the “layout” package: 018 <p> 019 * <ul> 020 * <li> SpeciesReferenceGlyph: Here it describes a curve from/to the center 021 * piece of the parent {@link ReactionGlyph} to/from the {@link SpeciesGlyph} it represents. 022 <p> 023 * <li> ReactionGlyph: Here it describes a curve for the center piece of a 024 * reaction. 025 <p> 026 * <li> ReferenceGlyph: Here it describes a curve from/to the center piece of 027 * the parent {@link GeneralGlyph} to/from the glyph it represents. 028 <p> 029 * <li> GeneralGlyph: Here it describes a curve for the center piece of an 030 * additional relationship. 031 * 032 * </ul> <p> 033 * In the text above, the term 'center piece' refers to either the {@link Curve} 034 * element of a {@link ReactionGlyph}, or its {@link BoundingBox}. 035 */ 036 037public class Curve extends SBase { 038 private long swigCPtr; 039 040 protected Curve(long cPtr, boolean cMemoryOwn) 041 { 042 super(libsbmlJNI.Curve_SWIGUpcast(cPtr), cMemoryOwn); 043 swigCPtr = cPtr; 044 } 045 046 protected static long getCPtr(Curve obj) 047 { 048 return (obj == null) ? 0 : obj.swigCPtr; 049 } 050 051 protected static long getCPtrAndDisown (Curve obj) 052 { 053 long ptr = 0; 054 055 if (obj != null) 056 { 057 ptr = obj.swigCPtr; 058 obj.swigCMemOwn = false; 059 } 060 061 return ptr; 062 } 063 064 protected void finalize() { 065 delete(); 066 } 067 068 public synchronized void delete() { 069 if (swigCPtr != 0) { 070 if (swigCMemOwn) { 071 swigCMemOwn = false; 072 libsbmlJNI.delete_Curve(swigCPtr); 073 } 074 swigCPtr = 0; 075 } 076 super.delete(); 077 } 078 079 080/** 081 * Creates a curve with an empty list of segments. 082 */ public 083 Curve(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 084 this(libsbmlJNI.new_Curve__SWIG_0(level, version, pkgVersion), true); 085 } 086 087 088/** 089 * Creates a curve with an empty list of segments. 090 */ public 091 Curve(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 092 this(libsbmlJNI.new_Curve__SWIG_1(level, version), true); 093 } 094 095 096/** 097 * Creates a curve with an empty list of segments. 098 */ public 099 Curve(long level) throws org.sbml.libsbml.SBMLConstructorException { 100 this(libsbmlJNI.new_Curve__SWIG_2(level), true); 101 } 102 103 104/** 105 * Creates a curve with an empty list of segments. 106 */ public 107 Curve() throws org.sbml.libsbml.SBMLConstructorException { 108 this(libsbmlJNI.new_Curve__SWIG_3(), true); 109 } 110 111 112/** 113 * Creates a new {@link Curve} with the given {@link LayoutPkgNamespaces} object. 114 */ public 115 Curve(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 116 this(libsbmlJNI.new_Curve__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 117 } 118 119 120/** 121 * Creates a new {@link Curve} from the given {@link XMLNode} 122 */ public 123 Curve(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 124 this(libsbmlJNI.new_Curve__SWIG_5(XMLNode.getCPtr(node), node, l2version), true); 125 } 126 127 128/** 129 * Creates a new {@link Curve} from the given {@link XMLNode} 130 */ public 131 Curve(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 132 this(libsbmlJNI.new_Curve__SWIG_6(XMLNode.getCPtr(node), node), true); 133 } 134 135 136/** 137 * Copy constructor. 138 */ public 139 Curve(Curve source) throws org.sbml.libsbml.SBMLConstructorException { 140 this(libsbmlJNI.new_Curve__SWIG_7(Curve.getCPtr(source), source), true); 141 } 142 143 144/** 145 * Does nothing since no defaults are defined for {@link Curve}. 146 */ public 147 void initDefaults() { 148 libsbmlJNI.Curve_initDefaults(swigCPtr, this); 149 } 150 151 152/** 153 * Returns a refernce to the {@link ListOf} object That holds all the curve 154 * segments. 155 */ public 156 ListOfLineSegments getListOfCurveSegments() { 157 long cPtr = libsbmlJNI.Curve_getListOfCurveSegments(swigCPtr, this); 158 return (cPtr == 0) ? null : new ListOfLineSegments(cPtr, false); 159 } 160 161 162/** 163 * Returns a pointer to the curve segment with the given index. 164 * If the index is invalid, <code>null</code> is returned. 165 */ public 166 LineSegment getCurveSegment(long index) { 167 return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.Curve_getCurveSegment__SWIG_0(swigCPtr, this, index), false); 168} 169 170 171/** 172 * Adds a new CurveSegment to the end of the list. 173 */ public 174 void addCurveSegment(LineSegment segment) { 175 libsbmlJNI.Curve_addCurveSegment(swigCPtr, this, LineSegment.getCPtr(segment), segment); 176 } 177 178 179/** 180 * Returns the number of curve segments. 181 */ public 182 long getNumCurveSegments() { 183 return libsbmlJNI.Curve_getNumCurveSegments(swigCPtr, this); 184 } 185 186 187/** 188 * Creates a new {@link LineSegment} and adds it to the end of the list. A 189 * reference to the new {@link LineSegment} object is returned. 190 */ public 191 LineSegment createLineSegment() { 192 return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.Curve_createLineSegment(swigCPtr, this), false); 193} 194 195 196/** 197 * Creates a new {@link CubicBezier} and adds it to the end of the list. A 198 * reference to the new {@link CubicBezier} object is returned. 199 */ public 200 CubicBezier createCubicBezier() { 201 long cPtr = libsbmlJNI.Curve_createCubicBezier(swigCPtr, this); 202 return (cPtr == 0) ? null : new CubicBezier(cPtr, false); 203 } 204 205 206/** 207 * Returns the XML element name of 208 * this SBML object. 209 */ public 210 String getElementName() { 211 return libsbmlJNI.Curve_getElementName(swigCPtr, this); 212 } 213 214 215/** 216 * Creates and returns a deep copy of this {@link Curve}. 217 <p> 218 * @return a (deep) copy of this {@link Curve}. 219 */ public 220 Curve cloneObject() { 221 long cPtr = libsbmlJNI.Curve_cloneObject(swigCPtr, this); 222 return (cPtr == 0) ? null : new Curve(cPtr, true); 223 } 224 225 226/** 227 * Returns the libSBML type code of this object instance. 228 <p> 229 * <p> 230 * LibSBML attaches an identifying code to every kind of SBML object. These 231 * are integer constants known as <em>SBML type codes</em>. The names of all 232 * the codes begin with the characters “<code>SBML_</code>”. 233 * In the Java language interface for libSBML, the 234 * type codes are defined as static integer constants in the interface class 235 * {@link libsbmlConstants}. Note that different Level 3 236 * package plug-ins may use overlapping type codes; to identify the package 237 * to which a given object belongs, call the <code>getPackageName()</code> 238 * method on the object. 239 <p> 240 * @return the SBML type code for this object: 241 * {@link libsbmlConstants#SBML_LAYOUT_CURVE SBML_LAYOUT_CURVE} 242 <p> 243 * <p> 244 * @warning <span class='warning'>The specific integer values of the possible 245 * type codes may be reused by different Level 3 package plug-ins. 246 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 247 * both getTypeCode() and getPackageName()</strong>.</span> 248 <p> 249 * @see #getElementName() 250 * @see #getPackageName() 251 */ public 252 int getTypeCode() { 253 return libsbmlJNI.Curve_getTypeCode(swigCPtr, this); 254 } 255 256 257/** 258 * Creates an {@link XMLNode} object from this. 259 */ public 260 XMLNode toXML() { 261 return new XMLNode(libsbmlJNI.Curve_toXML(swigCPtr, this), true); 262 } 263 264 265/** 266 * Sets this SBML object to child SBML objects (if any). 267 * (Creates a child-parent relationship by the parent) 268 <p> 269 * Subclasses must override this function if they define 270 * one ore more child elements. 271 * Basically, this function needs to be called in 272 * constructor, copy constructor, assignment operator. 273 <p> 274 * @see setSBMLDocument 275 * @see enablePackageInternal 276 * @internal 277 */ public 278 void connectToChild() { 279 libsbmlJNI.Curve_connectToChild(swigCPtr, this); 280 } 281 282 283/** 284 * Enables/Disables the given package with this element and child 285 * elements (if any). 286 * (This is an internal implementation for enablePakcage function) 287 <p> 288 * @note Subclasses in which one or more child elements are defined 289 * must override this function. 290 * @internal 291 */ public 292 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 293 libsbmlJNI.Curve_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 294 } 295 296}