001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 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 011public class LayoutExtension extends SBMLExtension { 012 private long swigCPtr; 013 014 protected LayoutExtension(long cPtr, boolean cMemoryOwn) 015 { 016 super(libsbmlJNI.LayoutExtension_SWIGUpcast(cPtr), cMemoryOwn); 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(LayoutExtension obj) 021 { 022 return (obj == null) ? 0 : obj.swigCPtr; 023 } 024 025 protected static long getCPtrAndDisown (LayoutExtension obj) 026 { 027 long ptr = 0; 028 029 if (obj != null) 030 { 031 ptr = obj.swigCPtr; 032 obj.swigCMemOwn = false; 033 } 034 035 return ptr; 036 } 037 038 protected void finalize() { 039 delete(); 040 } 041 042 public synchronized void delete() { 043 if (swigCPtr != 0) { 044 if (swigCMemOwn) { 045 swigCMemOwn = false; 046 libsbmlJNI.delete_LayoutExtension(swigCPtr); 047 } 048 swigCPtr = 0; 049 } 050 super.delete(); 051 } 052 053 public SBasePlugin DowncastSBasePlugin(long cPtr, boolean owner) 054 { 055 if (cPtr == 0) return null; 056 057 SBasePlugin sbp = new SBasePlugin(cPtr,false); 058 SBase sb = sbp.getParentSBMLObject(); 059 060 if (sb == null) 061 { 062 return new SBasePlugin(cPtr,owner); 063 } 064 065 switch( sb.getTypeCode() ) 066 { 067 case libsbmlConstants.SBML_MODEL: 068 return new LayoutModelPlugin(cPtr,owner); 069 case libsbmlConstants.SBML_SPECIES_REFERENCE: 070 case libsbmlConstants.SBML_MODIFIER_SPECIES_REFERENCE: 071 return new LayoutSpeciesReferencePlugin(cPtr,owner); 072 default: 073 return new SBasePlugin(cPtr,owner); 074 } 075 } 076 077 /** 078 * SBMLExtension derived classes must override this method 079 * 080 * @return the most specific Java object possible for the given SBase 081 */ 082 public SBase DowncastSBase(long cPtr, boolean owner) 083 { 084 if (cPtr == 0) return null; 085 086 SBase sb = new SBase(cPtr,false); 087 088 switch( sb.getTypeCode() ) 089 { 090 case libsbmlConstants.SBML_LIST_OF: 091 String name = sb.getElementName(); 092 if(name.equals("listOfCompartmentGlyphs")){ 093 return new ListOfCompartmentGlyphs(cPtr, owner); 094 } 095 else if(name.equals("listOfAdditionalGraphicalObjects")){ 096 return new ListOfGraphicalObjects(cPtr, owner); 097 } 098 else if(name.equals("listOfLayouts")){ 099 return new ListOfLayouts(cPtr, owner); 100 } 101 else if(name.equals("listOfCurveSegments")){ 102 return new ListOfLineSegments(cPtr, owner); 103 } 104 else if(name.equals("listOfSpeciesGlyphs")){ 105 return new ListOfSpeciesGlyphs(cPtr, owner); 106 } 107 else if(name.equals("listOfSpeciesReferenceGlyphs")){ 108 return new ListOfSpeciesReferenceGlyphs(cPtr, owner); 109 } 110 else if(name.equals("listOfReactionGlyphs")){ 111 return new ListOfReactionGlyphs(cPtr, owner); 112 } 113 else if(name.equals("listOfTextGlyphs")){ 114 return new ListOfTextGlyphs(cPtr, owner); 115 } 116 else if(name.equals("listOfReferenceGlyphs")){ 117 return new ListOfReferenceGlyphs(cPtr, owner); 118 } 119 return new ListOf(cPtr, owner); 120 121 case libsbmlConstants.SBML_LAYOUT_BOUNDINGBOX: 122 return new BoundingBox(cPtr, owner); 123 124 case libsbmlConstants.SBML_LAYOUT_COMPARTMENTGLYPH: 125 return new CompartmentGlyph(cPtr, owner); 126 127 case libsbmlConstants.SBML_LAYOUT_CUBICBEZIER: 128 return new CubicBezier(cPtr, owner); 129 130 case libsbmlConstants.SBML_LAYOUT_CURVE: 131 return new Curve(cPtr, owner); 132 133 case libsbmlConstants.SBML_LAYOUT_DIMENSIONS: 134 return new Dimensions(cPtr, owner); 135 136 case libsbmlConstants.SBML_LAYOUT_GRAPHICALOBJECT: 137 return new GraphicalObject(cPtr, owner); 138 139 case libsbmlConstants.SBML_LAYOUT_LAYOUT: 140 return new Layout(cPtr, owner); 141 142 case libsbmlConstants.SBML_LAYOUT_LINESEGMENT: 143 return new LineSegment(cPtr, owner); 144 145 case libsbmlConstants.SBML_LAYOUT_POINT: 146 return new Point(cPtr, owner); 147 148 case libsbmlConstants.SBML_LAYOUT_REACTIONGLYPH: 149 return new ReactionGlyph(cPtr, owner); 150 151 case libsbmlConstants.SBML_LAYOUT_SPECIESGLYPH: 152 return new SpeciesGlyph(cPtr, owner); 153 154 case libsbmlConstants.SBML_LAYOUT_SPECIESREFERENCEGLYPH: 155 return new SpeciesReferenceGlyph(cPtr, owner); 156 157 case libsbmlConstants.SBML_LAYOUT_TEXTGLYPH: 158 return new TextGlyph(cPtr, owner); 159 160 case (int) libsbml.SBML_LAYOUT_REFERENCEGLYPH: 161 return new ReferenceGlyph(cPtr, owner); 162 163 case (int) libsbml.SBML_LAYOUT_GENERALGLYPH: 164 return new GeneralGlyph(cPtr, owner); 165 166 default: 167 return new SBase(cPtr, owner); 168 } 169 } 170 171 public static String getPackageName() { 172 return libsbmlJNI.LayoutExtension_getPackageName(); 173 } 174 175 public static long getDefaultLevel() { 176 return libsbmlJNI.LayoutExtension_getDefaultLevel(); 177 } 178 179 public static long getDefaultVersion() { 180 return libsbmlJNI.LayoutExtension_getDefaultVersion(); 181 } 182 183 public static long getDefaultPackageVersion() { 184 return libsbmlJNI.LayoutExtension_getDefaultPackageVersion(); 185 } 186 187 public static String getXmlnsL3V1V1() { 188 return libsbmlJNI.LayoutExtension_getXmlnsL3V1V1(); 189 } 190 191 public static String getXmlnsL2() { 192 return libsbmlJNI.LayoutExtension_getXmlnsL2(); 193 } 194 195 public static String getXmlnsXSI() { 196 return libsbmlJNI.LayoutExtension_getXmlnsXSI(); 197 } 198 199 public LayoutExtension() { 200 this(libsbmlJNI.new_LayoutExtension__SWIG_0(), true); 201 } 202 203 public LayoutExtension(LayoutExtension arg0) { 204 this(libsbmlJNI.new_LayoutExtension__SWIG_1(LayoutExtension.getCPtr(arg0), arg0), true); 205 } 206 207 208/** 209 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function 210 * in their derived class. 211 * <p> 212 * Creates and returns a deep copy of this {@link SBMLExtension} object. 213 * <p> 214 * @return a (deep) copy of this {@link SBase} object 215 * @internal 216 */ public 217 LayoutExtension cloneObject() { 218 long cPtr = libsbmlJNI.LayoutExtension_cloneObject(swigCPtr, this); 219 return (cPtr == 0) ? null : new LayoutExtension(cPtr, true); 220 } 221 222 223/** 224 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function 225 * in their derived class. 226 * <p> 227 * Returns the name of this package (e.g. 'layout', 'multi'). 228 * <p> 229 * @return the name of package extension 230 * @internal 231 */ public 232 String getName() { 233 return libsbmlJNI.LayoutExtension_getName(swigCPtr, this); 234 } 235 236 237/** 238 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function 239 * in their derived class. 240 * <p> 241 * Returns the uri corresponding to the given SBML level, SBML version, and package version. 242 * <p> 243 * @param sbmlLevel the level of SBML 244 * @param sbmlVersion the version of SBML 245 * @param pkgVersion the version of package 246 * <p> 247 * @return a string of the package URI 248 * @internal 249 */ public 250 String getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) { 251 return libsbmlJNI.LayoutExtension_getURI(swigCPtr, this, sbmlLevel, sbmlVersion, pkgVersion); 252 } 253 254 255/** 256 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function 257 * in their derived class. 258 * <p> 259 * Returns the SBML level associated with the given URI of this package. 260 * <p> 261 * @param uri the string of URI that represents a versions of the package 262 * @return the SBML level associated with the given URI of this package. 263 * @internal 264 */ public 265 long getLevel(String uri) { 266 return libsbmlJNI.LayoutExtension_getLevel(swigCPtr, this, uri); 267 } 268 269 270/** 271 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function 272 * in their derived class. 273 * <p> 274 * Returns the SBML version associated with the given URI of this package. 275 * <p> 276 * @param uri the string of URI that represents a versions of the package 277 * @return the SBML version associated with the given URI of this package. 278 * @internal 279 */ public 280 long getVersion(String uri) { 281 return libsbmlJNI.LayoutExtension_getVersion(swigCPtr, this, uri); 282 } 283 284 285/** 286 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function 287 * in their derived class. 288 * <p> 289 * Returns the package version associated with the given URI of this package. 290 * <p> 291 * @param uri the string of URI that represents a versions of this package 292 * @return the package version associated with the given URI of this package. 293 * @internal 294 */ public 295 long getPackageVersion(String uri) { 296 return libsbmlJNI.LayoutExtension_getPackageVersion(swigCPtr, this, uri); 297 } 298 299 300/** 301 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function 302 * in their derived class. 303 * <p> 304 * This method takes a type code of this package and returns a string 305 * representing the code. 306 * @internal 307 */ public 308 String getStringFromTypeCode(int typeCode) { 309 return libsbmlJNI.LayoutExtension_getStringFromTypeCode(swigCPtr, this, typeCode); 310 } 311 312 313/** 314 * (NOTICE) Package developers MUST OVERRIDE this pure virtual function in 315 * their derived class. 316 * <p> 317 * Returns an {@link SBMLExtensionNamespaces}<class SBMLExtensionType> object 318 * (e.g. {@link SBMLExtensionNamespaces}<LayoutExtension> whose alias type is 319 * LayoutPkgNamespaces) corresponding to the given uri. 320 * Null will be returned if the given uri is not defined in the corresponding 321 * package. 322 * <p> 323 * @param uri the string of URI that represents one of versions of the package 324 * @return an {@link SBMLExtensionNamespaces}<class SBMLExtensionType> object. null 325 * will be returned if the given uri is not defined in the corresponding 326 * package. 327 * @internal 328 */ public 329 SBMLNamespaces getSBMLExtensionNamespaces(String uri) { 330 return libsbml.DowncastSBMLNamespaces(libsbmlJNI.LayoutExtension_getSBMLExtensionNamespaces(swigCPtr, this, uri), false); 331} 332 333 public static void init() { 334 libsbmlJNI.LayoutExtension_init(); 335 } 336 337 338/** 339 * Removes the L2 Namespaces. 340 * <p> 341 * This method should be overridden by all extensions that want to serialize 342 * to an L2 annotation. 343 * @internal 344 */ public 345 void removeL2Namespaces(XMLNamespaces xmlns) { 346 libsbmlJNI.LayoutExtension_removeL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns); 347 } 348 349 350/** 351 * adds all L2 Extension namespaces to the namespace list. 352 * <p> 353 * This method should be overridden by all extensions that want to serialize 354 * to an L2 annotation. 355 * @internal 356 */ public 357 void addL2Namespaces(XMLNamespaces xmlns) { 358 libsbmlJNI.LayoutExtension_addL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns); 359 } 360 361 362/** 363 * Adds the L2 Namespace to the document and enables the extension. 364 * <p> 365 * If the extension supports serialization to SBML L2 Annotations, this 366 * method should be overrridden, so it will be activated. 367 * @internal 368 */ public 369 void enableL2NamespaceForDocument(SBMLDocument doc) { 370 libsbmlJNI.LayoutExtension_enableL2NamespaceForDocument(swigCPtr, this, SBMLDocument.getCPtr(doc), doc); 371 } 372 373 374/** 375 * Determines whether this extension is being used by the given {@link SBMLDocument} 376 * <p> 377 * The default implementation returns true. This means that when a document 378 * had this extension enabled, it will not be possible to convert it to L2 379 * as we cannot make sure that the extension can be converted. 380 * <p> 381 * @param doc the sbml document to test. 382 * <p> 383 * @return a boolean indicating whether the extension is actually being used 384 * byy the document. 385 * @internal 386 */ public 387 boolean isInUse(SBMLDocument doc) { 388 return libsbmlJNI.LayoutExtension_isInUse(swigCPtr, this, SBMLDocument.getCPtr(doc), doc); 389 } 390 391}