001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.8 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 * Set of SBML Level + Version + namespace triples. 013 <p> 014 * <p style='color: #777; font-style: italic'> 015This class of objects is defined by libSBML only and has no direct 016equivalent in terms of SBML components. This class is not prescribed by 017the SBML specifications, although it is used to implement features 018defined in SBML. 019</p> 020 021 <p> 022 * There are differences in the definitions of components between different 023 * SBML Levels, as well as Versions within Levels. For example, the 024 * 'sboTerm' attribute was not introduced until Level 2 025 * Version 2, and then only on certain component classes; the SBML 026 * Level 2 Version 3 specification moved the 'sboTerm' attribute 027 * to the {@link SBase} class, thereby allowing nearly all components to have {@link SBO} 028 * annotations. As a result of differences such as those, libSBML needs to 029 * track the SBML Level and Version of every object created. 030 <p> 031 * The purpose of the {@link SBMLNamespaces} object class is to make it easier to 032 * communicate SBML Level and Version data between libSBML constructors and 033 * other methods. The {@link SBMLNamespaces} object class tracks 3-tuples 034 * (triples) consisting of SBML Level, Version, and the corresponding SBML 035 * XML namespace. 036 <p> 037 * The plural name (SBMLNamespaces) is not a mistake, because in SBML 038 * Level 3, objects may have extensions added by Level 3 packages 039 * used by a given model and therefore may have multiple namespaces 040 * associated with them; however, until the introduction of SBML 041 * Level 3, the {@link SBMLNamespaces} object only records one SBML 042 * Level/Version/namespace combination at a time. Most constructors for 043 * SBML objects in libSBML take a {@link SBMLNamespaces} object as an argument, 044 * thereby allowing the constructor to produce the proper combination of 045 * attributes and other internal data structures for the given SBML Level 046 * and Version. 047 */ 048 049public class SBMLNamespaces { 050 private long swigCPtr; 051 protected boolean swigCMemOwn; 052 053 protected SBMLNamespaces(long cPtr, boolean cMemoryOwn) 054 { 055 swigCMemOwn = cMemoryOwn; 056 swigCPtr = cPtr; 057 } 058 059 protected static long getCPtr(SBMLNamespaces obj) 060 { 061 return (obj == null) ? 0 : obj.swigCPtr; 062 } 063 064 protected static long getCPtrAndDisown (SBMLNamespaces obj) 065 { 066 long ptr = 0; 067 068 if (obj != null) 069 { 070 ptr = obj.swigCPtr; 071 obj.swigCMemOwn = false; 072 } 073 074 return ptr; 075 } 076 077 protected void finalize() { 078 delete(); 079 } 080 081 public synchronized void delete() { 082 if (swigCPtr != 0) { 083 if (swigCMemOwn) { 084 swigCMemOwn = false; 085 libsbmlJNI.delete_SBMLNamespaces(swigCPtr); 086 } 087 swigCPtr = 0; 088 } 089 } 090 091 /** 092 * Equality comparison method for SBMLNamespaces. 093 * <p> 094 * Because the Java methods for libSBML are actually wrappers around code 095 * implemented in C++ and C, certain operations will not behave as 096 * expected. Equality comparison is one such case. An instance of a 097 * libSBML object class is actually a <em>proxy object</em> 098 * wrapping the real underlying C/C++ object. The normal <code>==</code> 099 * equality operator in Java will <em>only compare the Java proxy objects</em>, 100 * not the underlying native object. The result is almost never what you 101 * want in practical situations. Unfortunately, Java does not provide a 102 * way to override <code>==</code>. 103 * <p> 104 * The alternative that must be followed is to use the 105 * <code>equals()</code> method. The <code>equals</code> method on this 106 * class overrides the default java.lang.Object one, and performs an 107 * intelligent comparison of instances of objects of this class. The 108 * result is an assessment of whether two libSBML Java objects are truly 109 * the same underlying native-code objects. 110 * <p> 111 * The use of this method in practice is the same as the use of any other 112 * Java <code>equals</code> method. For example, 113 * <em>a</em><code>.equals(</code><em>b</em><code>)</code> returns 114 * <code>true</code> if <em>a</em> and <em>b</em> are references to the 115 * same underlying object. 116 * 117 * @param sb a reference to an object to which the current object 118 * instance will be compared 119 * 120 * @return <code>true</code> if <code>sb</code> refers to the same underlying 121 * native object as this one, <code>false</code> otherwise 122 */ 123 public boolean equals(Object sb) 124 { 125 if ( this == sb ) 126 { 127 return true; 128 } 129 return swigCPtr == getCPtr((SBMLNamespaces)(sb)); 130 } 131 132 /** 133 * Returns a hashcode for this SBMLNamespaces object. 134 * 135 * @return a hash code usable by Java methods that need them. 136 */ 137 public int hashCode() 138 { 139 return (int)(swigCPtr^(swigCPtr>>>32)); 140 } 141 142 143/** 144 * Creates a new {@link SBMLNamespaces} object corresponding to the given SBML 145 * <code>level</code> and <code>version</code>. 146 <p> 147 * <p> 148 * {@link SBMLNamespaces} objects are used in libSBML to communicate SBML Level and 149 * Version data between constructors and other methods. The {@link SBMLNamespaces} 150 * object class holds triples consisting of SBML Level, Version, and the 151 * corresponding SBML XML namespace. Most constructors for SBML objects in 152 * libSBML take a {@link SBMLNamespaces} object as an argument, thereby allowing 153 * the constructor to produce the proper combination of attributes and 154 * other internal data structures for the given SBML Level and Version. 155 <p> 156 * The plural name (SBMLNamespaces) is not a mistake, because in SBML 157 * Level 3, objects may have extensions added by Level 3 packages 158 * used by a given model and therefore may have multiple namespaces 159 * associated with them. In SBML Levels below Level 3, the 160 * {@link SBMLNamespaces} object only records one SBML Level/Version/namespace 161 * combination at a time. Most constructors for SBML objects in libSBML 162 * take a {@link SBMLNamespaces} object as an argument, thereby allowing the 163 * constructor to produce the proper combination of attributes and other 164 * internal data structures for the given SBML Level and Version. 165 <p> 166 * @param level the SBML level 167 * @param version the SBML version 168 <p> 169 * 170</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 171The native C++ implementation of this method defines a default argument 172value. In the documentation generated for different libSBML language 173bindings, you may or may not see corresponding arguments in the method 174declarations. For example, in Java and C#, a default argument is handled by 175declaring two separate methods, with one of them having the argument and 176the other one lacking the argument. However, the libSBML documentation will 177be <em>identical</em> for both methods. Consequently, if you are reading 178this and do not see an argument even though one is described, please look 179for descriptions of other variants of this method near where this one 180appears in the documentation. 181</dd></dl> 182 183 */ public 184 SBMLNamespaces(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 185 this(libsbmlJNI.new_SBMLNamespaces__SWIG_0(level, version), true); 186 } 187 188 189/** 190 * Creates a new {@link SBMLNamespaces} object corresponding to the given SBML 191 * <code>level</code> and <code>version</code>. 192 <p> 193 * <p> 194 * {@link SBMLNamespaces} objects are used in libSBML to communicate SBML Level and 195 * Version data between constructors and other methods. The {@link SBMLNamespaces} 196 * object class holds triples consisting of SBML Level, Version, and the 197 * corresponding SBML XML namespace. Most constructors for SBML objects in 198 * libSBML take a {@link SBMLNamespaces} object as an argument, thereby allowing 199 * the constructor to produce the proper combination of attributes and 200 * other internal data structures for the given SBML Level and Version. 201 <p> 202 * The plural name (SBMLNamespaces) is not a mistake, because in SBML 203 * Level 3, objects may have extensions added by Level 3 packages 204 * used by a given model and therefore may have multiple namespaces 205 * associated with them. In SBML Levels below Level 3, the 206 * {@link SBMLNamespaces} object only records one SBML Level/Version/namespace 207 * combination at a time. Most constructors for SBML objects in libSBML 208 * take a {@link SBMLNamespaces} object as an argument, thereby allowing the 209 * constructor to produce the proper combination of attributes and other 210 * internal data structures for the given SBML Level and Version. 211 <p> 212 * @param level the SBML level 213 * @param version the SBML version 214 <p> 215 * 216</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 217The native C++ implementation of this method defines a default argument 218value. In the documentation generated for different libSBML language 219bindings, you may or may not see corresponding arguments in the method 220declarations. For example, in Java and C#, a default argument is handled by 221declaring two separate methods, with one of them having the argument and 222the other one lacking the argument. However, the libSBML documentation will 223be <em>identical</em> for both methods. Consequently, if you are reading 224this and do not see an argument even though one is described, please look 225for descriptions of other variants of this method near where this one 226appears in the documentation. 227</dd></dl> 228 229 */ public 230 SBMLNamespaces(long level) throws org.sbml.libsbml.SBMLConstructorException { 231 this(libsbmlJNI.new_SBMLNamespaces__SWIG_1(level), true); 232 } 233 234 235/** 236 * Creates a new {@link SBMLNamespaces} object corresponding to the given SBML 237 * <code>level</code> and <code>version</code>. 238 <p> 239 * <p> 240 * {@link SBMLNamespaces} objects are used in libSBML to communicate SBML Level and 241 * Version data between constructors and other methods. The {@link SBMLNamespaces} 242 * object class holds triples consisting of SBML Level, Version, and the 243 * corresponding SBML XML namespace. Most constructors for SBML objects in 244 * libSBML take a {@link SBMLNamespaces} object as an argument, thereby allowing 245 * the constructor to produce the proper combination of attributes and 246 * other internal data structures for the given SBML Level and Version. 247 <p> 248 * The plural name (SBMLNamespaces) is not a mistake, because in SBML 249 * Level 3, objects may have extensions added by Level 3 packages 250 * used by a given model and therefore may have multiple namespaces 251 * associated with them. In SBML Levels below Level 3, the 252 * {@link SBMLNamespaces} object only records one SBML Level/Version/namespace 253 * combination at a time. Most constructors for SBML objects in libSBML 254 * take a {@link SBMLNamespaces} object as an argument, thereby allowing the 255 * constructor to produce the proper combination of attributes and other 256 * internal data structures for the given SBML Level and Version. 257 <p> 258 * @param level the SBML level 259 * @param version the SBML version 260 <p> 261 * 262</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 263The native C++ implementation of this method defines a default argument 264value. In the documentation generated for different libSBML language 265bindings, you may or may not see corresponding arguments in the method 266declarations. For example, in Java and C#, a default argument is handled by 267declaring two separate methods, with one of them having the argument and 268the other one lacking the argument. However, the libSBML documentation will 269be <em>identical</em> for both methods. Consequently, if you are reading 270this and do not see an argument even though one is described, please look 271for descriptions of other variants of this method near where this one 272appears in the documentation. 273</dd></dl> 274 275 */ public 276 SBMLNamespaces() throws org.sbml.libsbml.SBMLConstructorException { 277 this(libsbmlJNI.new_SBMLNamespaces__SWIG_2(), true); 278 } 279 280 281/** 282 * (For extensions) Creates a new {@link SBMLNamespaces} object corresponding to 283 * the combination of (1) the given SBML <code>level</code> and <code>version</code>, and (2) 284 * the given <code>package</code> with the <code>package</code> <code>version</code>. 285 <p> 286 * <p> 287 * {@link SBMLNamespaces} objects are used in libSBML to communicate SBML Level and 288 * Version data between constructors and other methods. The {@link SBMLNamespaces} 289 * object class holds triples consisting of SBML Level, Version, and the 290 * corresponding SBML XML namespace. Most constructors for SBML objects in 291 * libSBML take a {@link SBMLNamespaces} object as an argument, thereby allowing 292 * the constructor to produce the proper combination of attributes and 293 * other internal data structures for the given SBML Level and Version. 294 <p> 295 * The plural name (SBMLNamespaces) is not a mistake, because in SBML 296 * Level 3, objects may have extensions added by Level 3 packages 297 * used by a given model and therefore may have multiple namespaces 298 * associated with them. In SBML Levels below Level 3, the 299 * {@link SBMLNamespaces} object only records one SBML Level/Version/namespace 300 * combination at a time. Most constructors for SBML objects in libSBML 301 * take a {@link SBMLNamespaces} object as an argument, thereby allowing the 302 * constructor to produce the proper combination of attributes and other 303 * internal data structures for the given SBML Level and Version. 304 <p> 305 * @param level the SBML Level 306 * @param version the SBML Version 307 * @param pkgName the string of package name (e.g. 'layout', 'multi') 308 * @param pkgVersion the package version 309 * @param pkgPrefix the prefix of the package namespace (e.g. 'layout', 'multi') to be added. 310 * The package's name will be used if the given string is empty (default). 311 <p> 312 * @throws SBMLExtensionException if the extension module that supports the 313 * combination of the given SBML Level, SBML Version, package name, and 314 * package version has not been registered with libSBML. 315 */ public 316 SBMLNamespaces(long level, long version, String pkgName, long pkgVersion, String pkgPrefix) throws org.sbml.libsbml.SBMLConstructorException { 317 this(libsbmlJNI.new_SBMLNamespaces__SWIG_3(level, version, pkgName, pkgVersion, pkgPrefix), true); 318 } 319 320 321/** 322 * (For extensions) Creates a new {@link SBMLNamespaces} object corresponding to 323 * the combination of (1) the given SBML <code>level</code> and <code>version</code>, and (2) 324 * the given <code>package</code> with the <code>package</code> <code>version</code>. 325 <p> 326 * <p> 327 * {@link SBMLNamespaces} objects are used in libSBML to communicate SBML Level and 328 * Version data between constructors and other methods. The {@link SBMLNamespaces} 329 * object class holds triples consisting of SBML Level, Version, and the 330 * corresponding SBML XML namespace. Most constructors for SBML objects in 331 * libSBML take a {@link SBMLNamespaces} object as an argument, thereby allowing 332 * the constructor to produce the proper combination of attributes and 333 * other internal data structures for the given SBML Level and Version. 334 <p> 335 * The plural name (SBMLNamespaces) is not a mistake, because in SBML 336 * Level 3, objects may have extensions added by Level 3 packages 337 * used by a given model and therefore may have multiple namespaces 338 * associated with them. In SBML Levels below Level 3, the 339 * {@link SBMLNamespaces} object only records one SBML Level/Version/namespace 340 * combination at a time. Most constructors for SBML objects in libSBML 341 * take a {@link SBMLNamespaces} object as an argument, thereby allowing the 342 * constructor to produce the proper combination of attributes and other 343 * internal data structures for the given SBML Level and Version. 344 <p> 345 * @param level the SBML Level 346 * @param version the SBML Version 347 * @param pkgName the string of package name (e.g. 'layout', 'multi') 348 * @param pkgVersion the package version 349 * @param pkgPrefix the prefix of the package namespace (e.g. 'layout', 'multi') to be added. 350 * The package's name will be used if the given string is empty (default). 351 <p> 352 * @throws SBMLExtensionException if the extension module that supports the 353 * combination of the given SBML Level, SBML Version, package name, and 354 * package version has not been registered with libSBML. 355 */ public 356 SBMLNamespaces(long level, long version, String pkgName, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 357 this(libsbmlJNI.new_SBMLNamespaces__SWIG_4(level, version, pkgName, pkgVersion), true); 358 } 359 360 361/** 362 * Copy constructor; creates a copy of a {@link SBMLNamespaces}. 363 <p> 364 * @param orig the {@link SBMLNamespaces} instance to copy. 365 */ public 366 SBMLNamespaces(SBMLNamespaces orig) throws org.sbml.libsbml.SBMLConstructorException { 367 this(libsbmlJNI.new_SBMLNamespaces__SWIG_5(SBMLNamespaces.getCPtr(orig), orig), true); 368 } 369 370 371/** 372 * Creates and returns a deep copy of this {@link SBMLNamespaces} object. 373 <p> 374 * @return the (deep) copy of this {@link SBMLNamespaces} object. 375 */ public 376 SBMLNamespaces cloneObject() { 377 return libsbml.DowncastSBMLNamespaces(libsbmlJNI.SBMLNamespaces_cloneObject(swigCPtr, this), true); 378} 379 380 381/** 382 * Returns a string representing the SBML XML namespace for the 383 * given <code>level</code> and <code>version</code> of SBML. 384 <p> 385 * @param level the SBML level 386 * @param version the SBML version 387 <p> 388 * @return a string representing the SBML namespace that reflects the 389 * SBML Level and Version specified. 390 <p> 391 * 392 */ public 393 static String getSBMLNamespaceURI(long level, long version) { 394 return libsbmlJNI.SBMLNamespaces_getSBMLNamespaceURI(level, version); 395 } 396 397 398/** 399 * Returns a list of all supported {@link SBMLNamespaces} in this version of 400 * libsbml. 401 <p> 402 * @return a list with supported SBML namespaces. 403 <p> 404 * 405 */ public 406 static SBMLNamespacesList getSupportedNamespaces() { 407 long cPtr = libsbmlJNI.SBMLNamespaces_getSupportedNamespaces(); 408 return (cPtr == 0) ? null : new SBMLNamespacesList(cPtr, true); 409} 410 411 412/** 413 * Frees the list of supported namespaces as generated by 414 * getSupportedNamespaces(). 415 <p> 416 * @param supportedNS the list to be freed. 417 <p> 418 * 419 */ public 420 static void freeSBMLNamespaces(SWIGTYPE_p_List supportedNS) { 421 libsbmlJNI.SBMLNamespaces_freeSBMLNamespaces(SWIGTYPE_p_List.getCPtr(supportedNS)); 422 } 423 424 425/** 426 * Returns a string representing the SBML XML namespace of this 427 * object. 428 <p> 429 * @return a string representing the SBML namespace that reflects the 430 * SBML Level and Version of this object. 431 */ public 432 String getURI() { 433 return libsbmlJNI.SBMLNamespaces_getURI(swigCPtr, this); 434 } 435 436 437/** 438 * Get the SBML Level of this {@link SBMLNamespaces} object. 439 <p> 440 * @return the SBML Level of this {@link SBMLNamespaces} object. 441 */ public 442 long getLevel() { 443 return libsbmlJNI.SBMLNamespaces_getLevel__SWIG_0(swigCPtr, this); 444 } 445 446 447/** 448 * Get the SBML Version of this {@link SBMLNamespaces} object. 449 <p> 450 * @return the SBML Version of this {@link SBMLNamespaces} object. 451 */ public 452 long getVersion() { 453 return libsbmlJNI.SBMLNamespaces_getVersion__SWIG_0(swigCPtr, this); 454 } 455 456 457/** 458 * Get the XML namespaces list for this {@link SBMLNamespaces} object. 459 <p> 460 * <p> 461 * {@link SBMLNamespaces} objects are used in libSBML to communicate SBML Level and 462 * Version data between constructors and other methods. The {@link SBMLNamespaces} 463 * object class holds triples consisting of SBML Level, Version, and the 464 * corresponding SBML XML namespace. Most constructors for SBML objects in 465 * libSBML take a {@link SBMLNamespaces} object as an argument, thereby allowing 466 * the constructor to produce the proper combination of attributes and 467 * other internal data structures for the given SBML Level and Version. 468 <p> 469 * The plural name (SBMLNamespaces) is not a mistake, because in SBML 470 * Level 3, objects may have extensions added by Level 3 packages 471 * used by a given model and therefore may have multiple namespaces 472 * associated with them. In SBML Levels below Level 3, the 473 * {@link SBMLNamespaces} object only records one SBML Level/Version/namespace 474 * combination at a time. Most constructors for SBML objects in libSBML 475 * take a {@link SBMLNamespaces} object as an argument, thereby allowing the 476 * constructor to produce the proper combination of attributes and other 477 * internal data structures for the given SBML Level and Version. 478 <p> 479 * @return the XML namespaces of this {@link SBMLNamespaces} object. 480 */ public 481 XMLNamespaces getNamespaces() { 482 long cPtr = libsbmlJNI.SBMLNamespaces_getNamespaces__SWIG_0(swigCPtr, this); 483 return (cPtr == 0) ? null : new XMLNamespaces(cPtr, false); 484 } 485 486 487/** 488 * Add the given XML namespaces list to the set of namespaces within this 489 * {@link SBMLNamespaces} object. 490 <p> 491 * The following code gives an example of how one could add the XHTML 492 * namespace to the list of namespaces recorded by the top-level 493 * <code><sbml></code> element of a model. It gives the new 494 * namespace a prefix of <code>html</code>. 495 <p> 496<pre class='fragment'> 497{@link SBMLDocument} sd; 498try 499{ 500 sd = new {@link SBMLDocument}(3, 1); 501} 502catch (SBMLConstructorException e) 503{ 504 // Here, have code to handle a truly exceptional situation. Candidate 505 // causes include invalid combinations of SBML Level and Version 506 // (impossible if hardwired as given here), running out of memory, and 507 // unknown system exceptions. 508} 509 510{@link SBMLNamespaces} sn = sd.getNamespaces(); 511if (sn != null) 512{ 513 sn.add('http://www.w3.org/1999/xhtml', 'html'); 514} 515else 516{ 517 // Handle another truly exceptional situation. 518 } 519</pre> 520<p> 521 * @param xmlns the XML namespaces to be added. 522 <p> 523 * <p> 524 * @return integer value indicating success/failure of the 525 * function. The possible values 526 * returned by this function are: 527 * <ul> 528 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 529 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 530 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 531 * </ul> 532 */ public 533 int addNamespaces(XMLNamespaces xmlns) { 534 return libsbmlJNI.SBMLNamespaces_addNamespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns); 535 } 536 537 538/** 539 * Add an XML namespace (a pair of URI and prefix) to the set of namespaces 540 * within this {@link SBMLNamespaces} object. 541 <p> 542 * @param uri the XML namespace to be added. 543 * @param prefix the prefix of the namespace to be added. 544 <p> 545 * <p> 546 * @return integer value indicating success/failure of the 547 * function. The possible values 548 * returned by this function are: 549 * <ul> 550 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 551 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 552 * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT} 553 * </ul> 554 */ public 555 int addNamespace(String uri, String prefix) { 556 return libsbmlJNI.SBMLNamespaces_addNamespace(swigCPtr, this, uri, prefix); 557 } 558 559 560/** 561 * Removes an XML namespace from the set of namespaces within this 562 * {@link SBMLNamespaces} object. 563 <p> 564 * @param uri the XML namespace to be added. 565 <p> 566 * <p> 567 * @return integer value indicating success/failure of the 568 * function. The possible values 569 * returned by this function are: 570 * <ul> 571 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 572 * <li> {@link libsbmlConstants#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE} 573 * </ul> 574 */ public 575 int removeNamespace(String uri) { 576 return libsbmlJNI.SBMLNamespaces_removeNamespace(swigCPtr, this, uri); 577 } 578 579 580/** 581 * Add an XML namespace (a pair of URI and prefix) of a package extension 582 * to the set of namespaces within this {@link SBMLNamespaces} object. 583 <p> 584 * The SBML Level and SBML Version of this object is used. 585 <p> 586 * @param pkgName the string of package name (e.g. 'layout', 'multi') 587 * @param pkgVersion the package version 588 * @param prefix the prefix of the package namespace to be added. 589 * The package's name will be used if the given string is empty (default). 590 <p> 591 * <p> 592 * @return integer value indicating success/failure of the 593 * function. The possible values 594 * returned by this function are: 595 * <ul> 596 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 597 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 598 * 599 * </ul> <p> 600 * @note An XML namespace of a non-registered package extension can't be 601 * added by this function ({@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 602 * will be returned). 603 <p> 604 * @see #addNamespace(String, String) 605 */ public 606 int addPackageNamespace(String pkgName, long pkgVersion, String prefix) { 607 return libsbmlJNI.SBMLNamespaces_addPackageNamespace__SWIG_0(swigCPtr, this, pkgName, pkgVersion, prefix); 608 } 609 610 611/** 612 * Add an XML namespace (a pair of URI and prefix) of a package extension 613 * to the set of namespaces within this {@link SBMLNamespaces} object. 614 <p> 615 * The SBML Level and SBML Version of this object is used. 616 <p> 617 * @param pkgName the string of package name (e.g. 'layout', 'multi') 618 * @param pkgVersion the package version 619 * @param prefix the prefix of the package namespace to be added. 620 * The package's name will be used if the given string is empty (default). 621 <p> 622 * <p> 623 * @return integer value indicating success/failure of the 624 * function. The possible values 625 * returned by this function are: 626 * <ul> 627 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 628 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 629 * 630 * </ul> <p> 631 * @note An XML namespace of a non-registered package extension can't be 632 * added by this function ({@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 633 * will be returned). 634 <p> 635 * @see #addNamespace(String, String) 636 */ public 637 int addPackageNamespace(String pkgName, long pkgVersion) { 638 return libsbmlJNI.SBMLNamespaces_addPackageNamespace__SWIG_1(swigCPtr, this, pkgName, pkgVersion); 639 } 640 641 642/** 643 * Add the XML namespaces of package extensions in the given XMLNamespace 644 * object to the set of namespaces within this {@link SBMLNamespaces} object 645 * (Non-package XML namespaces are not added by this function). 646 <p> 647 * @param xmlns the XML namespaces to be added. 648 <p> 649 * <p> 650 * @return integer value indicating success/failure of the 651 * function. The possible values 652 * returned by this function are: 653 * <ul> 654 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 655 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 656 * 657 * </ul> <p> 658 * @note XML namespaces of a non-registered package extensions are not 659 * added (just ignored) by this function. {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} will be returned if the given 660 * xmlns is null. 661 */ public 662 int addPackageNamespaces(XMLNamespaces xmlns) { 663 return libsbmlJNI.SBMLNamespaces_addPackageNamespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns); 664 } 665 666 667/** 668 * Removes an XML namespace of a package extension from the set of namespaces 669 * within this {@link SBMLNamespaces} object. 670 <p> 671 * @param level the SBML level 672 * @param version the SBML version 673 * @param pkgName the string of package name (e.g. 'layout', 'multi') 674 * @param pkgVersion the package version 675 <p> 676 * <p> 677 * @return integer value indicating success/failure of the 678 * function. The possible values 679 * returned by this function are: 680 * <ul> 681 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 682 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 683 * <li> {@link libsbmlConstants#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE} 684 * </ul> 685 */ public 686 int removePackageNamespace(long level, long version, String pkgName, long pkgVersion) { 687 return libsbmlJNI.SBMLNamespaces_removePackageNamespace(swigCPtr, this, level, version, pkgName, pkgVersion); 688 } 689 690 691/** * @internal */ public 692 int addPkgNamespace(String pkgName, long pkgVersion, String prefix) { 693 return libsbmlJNI.SBMLNamespaces_addPkgNamespace__SWIG_0(swigCPtr, this, pkgName, pkgVersion, prefix); 694 } 695 696 697/** * @internal */ public 698 int addPkgNamespace(String pkgName, long pkgVersion) { 699 return libsbmlJNI.SBMLNamespaces_addPkgNamespace__SWIG_1(swigCPtr, this, pkgName, pkgVersion); 700 } 701 702 703/** * @internal */ public 704 int addPkgNamespaces(XMLNamespaces xmlns) { 705 return libsbmlJNI.SBMLNamespaces_addPkgNamespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns); 706 } 707 708 709/** * @internal */ public 710 int removePkgNamespace(long level, long version, String pkgName, long pkgVersion) { 711 return libsbmlJNI.SBMLNamespaces_removePkgNamespace(swigCPtr, this, level, version, pkgName, pkgVersion); 712 } 713 714 715/** 716 * Predicate returning <code>true</code> if the given URL is one of SBML XML 717 * namespaces. 718 <p> 719 * @param uri the URI of namespace 720 <p> 721 * @return <code>true</code> if the 'uri' is one of SBML namespaces, <code>false</code> otherwise. 722 <p> 723 * 724 */ public 725 static boolean isSBMLNamespace(String uri) { 726 return libsbmlJNI.SBMLNamespaces_isSBMLNamespace(uri); 727 } 728 729 730/** 731 * Predicate returning <code>true</code> if the given set of namespaces represent a 732 * valid set 733 <p> 734 * @return <code>true</code> if the set of namespaces is valid, <code>false</code> otherwise. 735 */ public 736 boolean isValidCombination() { 737 return libsbmlJNI.SBMLNamespaces_isValidCombination(swigCPtr, this); 738 } 739 740 741/** 742 * Returns the name of the main package for this namespace. 743 <p> 744 * @return the name of the main package for this namespace. 745 * 'core' will be returned if this namespace is defined in the SBML 746 * core. 747 */ public 748 String getPackageName() { 749 return libsbmlJNI.SBMLNamespaces_getPackageName(swigCPtr, this); 750 } 751 752}