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