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 Base extension class for the package. 015 */ 016 017public class LayoutExtension extends SBMLExtension { 018 private long swigCPtr; 019 020 protected LayoutExtension(long cPtr, boolean cMemoryOwn) 021 { 022 super(libsbmlJNI.LayoutExtension_SWIGUpcast(cPtr), cMemoryOwn); 023 swigCPtr = cPtr; 024 } 025 026 protected static long getCPtr(LayoutExtension obj) 027 { 028 return (obj == null) ? 0 : obj.swigCPtr; 029 } 030 031 protected static long getCPtrAndDisown (LayoutExtension obj) 032 { 033 long ptr = 0; 034 035 if (obj != null) 036 { 037 ptr = obj.swigCPtr; 038 obj.swigCMemOwn = false; 039 } 040 041 return ptr; 042 } 043 044 protected void finalize() { 045 delete(); 046 } 047 048 public synchronized void delete() { 049 if (swigCPtr != 0) { 050 if (swigCMemOwn) { 051 swigCMemOwn = false; 052 libsbmlJNI.delete_LayoutExtension(swigCPtr); 053 } 054 swigCPtr = 0; 055 } 056 super.delete(); 057 } 058 059 /** 060 * @internal 061 */ 062 public SBasePlugin DowncastSBasePlugin(long cPtr, boolean owner) 063 { 064 if (cPtr == 0) return null; 065 066 SBasePlugin sbp = new SBasePlugin(cPtr,false); 067 SBase sb = sbp.getParentSBMLObject(); 068 069 if (sb == null) 070 { 071 return new SBasePlugin(cPtr,owner); 072 } 073 074 switch( sb.getTypeCode() ) 075 { 076 case libsbmlConstants.SBML_MODEL: 077 return new LayoutModelPlugin(cPtr,owner); 078 case libsbmlConstants.SBML_SPECIES_REFERENCE: 079 case libsbmlConstants.SBML_MODIFIER_SPECIES_REFERENCE: 080 return new LayoutSpeciesReferencePlugin(cPtr,owner); 081 default: 082 return new SBasePlugin(cPtr,owner); 083 } 084 } 085 086 /** 087 * SBMLExtension derived classes must override this method 088 * 089 * @return the most specific Java object possible for the given SBase 090 * 091 * @internal 092 */ 093 public SBase DowncastSBase(long cPtr, boolean owner) 094 { 095 if (cPtr == 0) return null; 096 097 SBase sb = new SBase(cPtr,false); 098 099 switch( sb.getTypeCode() ) 100 { 101 case libsbmlConstants.SBML_LIST_OF: 102 String name = sb.getElementName(); 103 if(name.equals("listOfCompartmentGlyphs")){ 104 return new ListOfCompartmentGlyphs(cPtr, owner); 105 } 106 else if(name.equals("listOfAdditionalGraphicalObjects")){ 107 return new ListOfGraphicalObjects(cPtr, owner); 108 } 109 else if(name.equals("listOfLayouts")){ 110 return new ListOfLayouts(cPtr, owner); 111 } 112 else if(name.equals("listOfCurveSegments")){ 113 return new ListOfLineSegments(cPtr, owner); 114 } 115 else if(name.equals("listOfSpeciesGlyphs")){ 116 return new ListOfSpeciesGlyphs(cPtr, owner); 117 } 118 else if(name.equals("listOfSpeciesReferenceGlyphs")){ 119 return new ListOfSpeciesReferenceGlyphs(cPtr, owner); 120 } 121 else if(name.equals("listOfReactionGlyphs")){ 122 return new ListOfReactionGlyphs(cPtr, owner); 123 } 124 else if(name.equals("listOfTextGlyphs")){ 125 return new ListOfTextGlyphs(cPtr, owner); 126 } 127 else if(name.equals("listOfReferenceGlyphs")){ 128 return new ListOfReferenceGlyphs(cPtr, owner); 129 } 130 return new ListOf(cPtr, owner); 131 132 case libsbmlConstants.SBML_LAYOUT_BOUNDINGBOX: 133 return new BoundingBox(cPtr, owner); 134 135 case libsbmlConstants.SBML_LAYOUT_COMPARTMENTGLYPH: 136 return new CompartmentGlyph(cPtr, owner); 137 138 case libsbmlConstants.SBML_LAYOUT_CUBICBEZIER: 139 return new CubicBezier(cPtr, owner); 140 141 case libsbmlConstants.SBML_LAYOUT_CURVE: 142 return new Curve(cPtr, owner); 143 144 case libsbmlConstants.SBML_LAYOUT_DIMENSIONS: 145 return new Dimensions(cPtr, owner); 146 147 case libsbmlConstants.SBML_LAYOUT_GRAPHICALOBJECT: 148 return new GraphicalObject(cPtr, owner); 149 150 case libsbmlConstants.SBML_LAYOUT_LAYOUT: 151 return new Layout(cPtr, owner); 152 153 case libsbmlConstants.SBML_LAYOUT_LINESEGMENT: 154 return new LineSegment(cPtr, owner); 155 156 case libsbmlConstants.SBML_LAYOUT_POINT: 157 return new Point(cPtr, owner); 158 159 case libsbmlConstants.SBML_LAYOUT_REACTIONGLYPH: 160 return new ReactionGlyph(cPtr, owner); 161 162 case libsbmlConstants.SBML_LAYOUT_SPECIESGLYPH: 163 return new SpeciesGlyph(cPtr, owner); 164 165 case libsbmlConstants.SBML_LAYOUT_SPECIESREFERENCEGLYPH: 166 return new SpeciesReferenceGlyph(cPtr, owner); 167 168 case libsbmlConstants.SBML_LAYOUT_TEXTGLYPH: 169 return new TextGlyph(cPtr, owner); 170 171 case (int) libsbml.SBML_LAYOUT_REFERENCEGLYPH: 172 return new ReferenceGlyph(cPtr, owner); 173 174 case (int) libsbml.SBML_LAYOUT_GENERALGLYPH: 175 return new GeneralGlyph(cPtr, owner); 176 177 default: 178 return new SBase(cPtr, owner); 179 } 180 } 181 182 183/** 184 * Returns the nickname of the SBML Level 3 package implemented by 185 * this libSBML extension. 186 <p> 187 * @return the package nickname, as a string. 188 <p> 189 * 190 */ public 191 static String getPackageName() { 192 return libsbmlJNI.LayoutExtension_getPackageName(); 193 } 194 195 196/** 197 * Returns the default SBML Level used by this libSBML package extension. 198 <p> 199 * @return the SBML Level. 200 <p> 201 * 202 */ public 203 static long getDefaultLevel() { 204 return libsbmlJNI.LayoutExtension_getDefaultLevel(); 205 } 206 207 208/** 209 * Returns the default SBML Version used by this libSBML package extension. 210 <p> 211 * @return the Version within the default SBML Level. 212 <p> 213 * 214 */ public 215 static long getDefaultVersion() { 216 return libsbmlJNI.LayoutExtension_getDefaultVersion(); 217 } 218 219 220/** 221 * Returns the default version of the SBML Level 3 package implemented 222 * by this libSBML extension. 223 <p> 224 * @return the default version number of the SBML Level 3 package 225 * definition. 226 <p> 227 * 228 */ public 229 static long getDefaultPackageVersion() { 230 return libsbmlJNI.LayoutExtension_getDefaultPackageVersion(); 231 } 232 233 234/** 235 * Returns the XML namespace URI of the SBML Level 3 package 236 * implemented by this libSBML extension. 237 <p> 238 * @return the XML namespace as a string. 239 <p> 240 * 241 */ public 242 static String getXmlnsL3V1V1() { 243 return libsbmlJNI.LayoutExtension_getXmlnsL3V1V1(); 244 } 245 246 247/** 248 * Returns the XML namespace URI of the SBML Level 2 version 249 * of the package implemented by this libSBML Extension. 250 <p> 251 * Unique among the SBML Level 3 packages, the {@link Layout} package existed 252 * and was in widespread use prior to the introduction of SBML 253 * Level 3. The {@link Layout} package was used as model annotations in SBML 254 * Level 2. This method returns the SBML annotation XML namespace 255 * used for Level 2. 256 <p> 257 * @return the XML namespace as a string. 258 <p> 259 * 260 */ public 261 static String getXmlnsL2() { 262 return libsbmlJNI.LayoutExtension_getXmlnsL2(); 263 } 264 265 266/** 267 * Returns the XML namespace URI of any additional XML namespaces needed 268 * or used by this SBML Level 3 package. 269 <p> 270 * @return the XML namespace as a string. 271 <p> 272 * 273 */ public 274 static String getXmlnsXSI() { 275 return libsbmlJNI.LayoutExtension_getXmlnsXSI(); 276 } 277 278 279/** 280 * Creates a new {@link LayoutExtension} instance. 281 */ public 282 LayoutExtension() { 283 this(libsbmlJNI.new_LayoutExtension__SWIG_0(), true); 284 } 285 286 287/** 288 * Copy constructor. 289 */ public 290 LayoutExtension(LayoutExtension arg0) { 291 this(libsbmlJNI.new_LayoutExtension__SWIG_1(LayoutExtension.getCPtr(arg0), arg0), true); 292 } 293 294 295/** 296 * Creates and returns a deep copy of this {@link LayoutExtension} object. 297 <p> 298 * @return a (deep) copy of this {@link LayoutExtension} object 299 */ public 300 LayoutExtension cloneObject() { 301 long cPtr = libsbmlJNI.LayoutExtension_cloneObject(swigCPtr, this); 302 return (cPtr == 0) ? null : new LayoutExtension(cPtr, true); 303 } 304 305 306/** 307 * Returns the name of this package ('layout') 308 <p> 309 * @return the name of this package ('layout') 310 */ public 311 String getName() { 312 return libsbmlJNI.LayoutExtension_getName(swigCPtr, this); 313 } 314 315 316/** 317 * Returns the namespace URI corresponding to the combination of the given 318 * SBML Level, Version, and package version. 319 <p> 320 * @param sbmlLevel the level of SBML 321 * @param sbmlVersion the version of SBML 322 * @param pkgVersion the version of package 323 <p> 324 * @return a string of the package URI, or an empty string if no 325 * corresponding URI exists. 326 */ public 327 String getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) { 328 return libsbmlJNI.LayoutExtension_getURI(swigCPtr, this, sbmlLevel, sbmlVersion, pkgVersion); 329 } 330 331 332/** 333 * Returns the SBML Level for the given URI of this package. 334 <p> 335 * @param uri a URI that represents a version of this package. 336 <p> 337 * @return the SBML Level for the given URI of this package, or <code>0</code> if the 338 * given URI is invalid. 339 */ public 340 long getLevel(String uri) { 341 return libsbmlJNI.LayoutExtension_getLevel(swigCPtr, this, uri); 342 } 343 344 345/** 346 * Returns the Version within the SBML Level for the given URI of this 347 * package. 348 <p> 349 * @param uri a URI that represents a version of this package. 350 <p> 351 * @return the SBML Version within the SBML Level for the given URI of this 352 * package, or <code>0</code> if the given URI is invalid. 353 */ public 354 long getVersion(String uri) { 355 return libsbmlJNI.LayoutExtension_getVersion(swigCPtr, this, uri); 356 } 357 358 359/** 360 * Returns the SBML Level 3 package version for the given URI of this 361 * package. 362 <p> 363 * @param uri a URI that represents one of the valid versions of this 364 * package. 365 <p> 366 * @return the version of the SBML Level 3 package with the given URI, 367 * or <code>0</code> if the given URI is invalid. 368 */ public 369 long getPackageVersion(String uri) { 370 return libsbmlJNI.LayoutExtension_getPackageVersion(swigCPtr, this, uri); 371 } 372 373 374/** 375 * Takes a type code of the “layout” package and returns a string 376 * describing the code. 377 <p> 378 * @param typeCode a libSBML type code defined by the libSBML extension 379 * implementing support for the SBML Level 3 “layout” package. 380 <p> 381 * @return a text string representing the type code given by <code>typeCode</code>. 382 * If the type code is unrecognized for this implementation of the libSBML 383 * “layout” package, the string returned will be 384 * <code>'(Unknown SBML {@link Layout} Type)'</code>. 385 */ public 386 String getStringFromTypeCode(int typeCode) { 387 return libsbmlJNI.LayoutExtension_getStringFromTypeCode(swigCPtr, this, typeCode); 388 } 389 390 391/** 392 * Returns an {@link LayoutPkgNamespaces} object. 393 <p> 394 * @param uri a URI that represents one of the valid versions of the 395 * “layout” package 396 <p> 397 * @return an LayoutPkgNamespace object corresponding to the given <code>uri</code>, 398 * or <code>null</code> if the URI is not defined in the {@link Layout} package. 399 */ public 400 SBMLNamespaces getSBMLExtensionNamespaces(String uri) { 401 return libsbml.DowncastSBMLNamespaces(libsbmlJNI.LayoutExtension_getSBMLExtensionNamespaces(swigCPtr, this, uri), false); 402} 403 404 405/** * @internal */ public 406 static void init() { 407 libsbmlJNI.LayoutExtension_init(); 408 } 409 410 411/** 412 * Removes the L2 Namespace from a document. 413 <p> 414 * This method should be overridden by all extensions that want to serialize 415 * to an L2 annotation. 416 */ public 417 void removeL2Namespaces(XMLNamespaces xmlns) { 418 libsbmlJNI.LayoutExtension_removeL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns); 419 } 420 421 422/** 423 * adds all L2 Extension namespaces to the namespace list. 424 <p> 425 * This method should be overridden by all extensions that want to serialize 426 * to an L2 annotation. 427 */ public 428 void addL2Namespaces(XMLNamespaces xmlns) { 429 libsbmlJNI.LayoutExtension_addL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns); 430 } 431 432 433/** 434 * Adds the L2 Namespace to the document and enables the extension. 435 <p> 436 * If the extension supports serialization to SBML L2 Annotations, this 437 * method should be overrridden, so it will be activated. 438 */ public 439 void enableL2NamespaceForDocument(SBMLDocument doc) { 440 libsbmlJNI.LayoutExtension_enableL2NamespaceForDocument(swigCPtr, this, SBMLDocument.getCPtr(doc), doc); 441 } 442 443 444/** 445 * Determines whether this extension is being used by the given {@link SBMLDocument} 446 <p> 447 * The implementation returns true if the model object contains one 448 * or more layouts. 449 <p> 450 * @param doc the sbml document to test. 451 <p> 452 * @return a boolean indicating whether the extension is actually being used 453 * byy the document. 454 */ public 455 boolean isInUse(SBMLDocument doc) { 456 return libsbmlJNI.LayoutExtension_isInUse(swigCPtr, this, SBMLDocument.getCPtr(doc), doc); 457 } 458 459 460/** * @internal */ public 461 SWIGTYPE_p_packageErrorTableEntry getErrorTable(long index) { 462 return new SWIGTYPE_p_packageErrorTableEntry(libsbmlJNI.LayoutExtension_getErrorTable(swigCPtr, this, index), true); 463 } 464 465 466/** * @internal */ public 467 long getErrorTableIndex(long errorId) { 468 return libsbmlJNI.LayoutExtension_getErrorTableIndex(swigCPtr, this, errorId); 469 } 470 471 472/** * @internal */ public 473 long getErrorIdOffset() { 474 return libsbmlJNI.LayoutExtension_getErrorIdOffset(swigCPtr, this); 475 } 476 477}