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 * abstract base class for local and global render information. 013 <p> 014 * In the SBML render extension, local and global render information representations 015 * share many attributes. These are implemented in this abstract base class. 016 <p> 017 * {@link GlobalRenderInformation} and {@link LocalRenderInformation} are the classes that are derived 018 * from this base class. 019 <p> 020 * All render information objects have the following things in common: 021 <p> 022 * a) a set of color definitions 023 * b) a set of gradient definitions 024 * c) a set of line endings 025 <p> 026 * In addition to those, they share attributes for background color and some meta information 027 * as to which program created the render information etc. 028 */ 029 030public class RenderInformationBase extends SBase { 031 private long swigCPtr; 032 033 protected RenderInformationBase(long cPtr, boolean cMemoryOwn) 034 { 035 super(libsbmlJNI.RenderInformationBase_SWIGUpcast(cPtr), cMemoryOwn); 036 swigCPtr = cPtr; 037 } 038 039 protected static long getCPtr(RenderInformationBase obj) 040 { 041 return (obj == null) ? 0 : obj.swigCPtr; 042 } 043 044 protected static long getCPtrAndDisown (RenderInformationBase obj) 045 { 046 long ptr = 0; 047 048 if (obj != null) 049 { 050 ptr = obj.swigCPtr; 051 obj.swigCMemOwn = false; 052 } 053 054 return ptr; 055 } 056 057 protected void finalize() { 058 delete(); 059 } 060 061 public synchronized void delete() { 062 if (swigCPtr != 0) { 063 if (swigCMemOwn) { 064 swigCMemOwn = false; 065 libsbmlJNI.delete_RenderInformationBase(swigCPtr); 066 } 067 swigCPtr = 0; 068 } 069 super.delete(); 070 } 071 072 073/** 074 * Returns the program name that created the render information. 075 <p> 076 * @return the name string of the program 077 */ public 078 String getProgramName() { 079 return libsbmlJNI.RenderInformationBase_getProgramName(swigCPtr, this); 080 } 081 082 083/** 084 * Sets the name of the program that created the render information. 085 <p> 086 * @param name the name of the programm 087 */ public 088 void setProgramName(String name) { 089 libsbmlJNI.RenderInformationBase_setProgramName(swigCPtr, this, name); 090 } 091 092 093/** 094 * Returns the version of the program that created the render information. 095 <p> 096 * @return the version of the program as a string. 097 */ public 098 String getProgramVersion() { 099 return libsbmlJNI.RenderInformationBase_getProgramVersion(swigCPtr, this); 100 } 101 102 103/** 104 * Sets the version string of the program that created the render information. 105 <p> 106 * @param version version string of the program 107 */ public 108 void setProgramVersion(String version) { 109 libsbmlJNI.RenderInformationBase_setProgramVersion(swigCPtr, this, version); 110 } 111 112 113/** 114 * Returns the id of the referenced render information object. 115 * RenderInfromation objects can reference other render information objects 116 * and information that is not found in the current render information is then 117 * expected to be in the referenced render information object. 118 <p> 119 * Global render information objects can only reference other global 120 * render information objects, local render information objects can reference other local 121 * render information objects from the same list of local render information or other 122 * global render infromation. 123 <p> 124 * @return the id of the referenced render infromation object. 125 */ public 126 String getReferenceRenderInformationId() { 127 return libsbmlJNI.RenderInformationBase_getReferenceRenderInformationId(swigCPtr, this); 128 } 129 130 131/** 132 * Sets the id of the referenced render information object. 133 * The user has to make sure that render infromation referencing 134 * does not create loops. 135 <p> 136 * @param id the id of the referenced render infromation 137 */ public 138 void setReferenceRenderInformationId(String id) { 139 libsbmlJNI.RenderInformationBase_setReferenceRenderInformationId(swigCPtr, this, id); 140 } 141 142 143/** 144 * Returns the number of color definitions. 145 <p> 146 * @return the number of color definitions in the render information. 147 */ public 148 long getNumColorDefinitions() { 149 return libsbmlJNI.RenderInformationBase_getNumColorDefinitions(swigCPtr, this); 150 } 151 152 153/** 154 * Returns a pointer to the list of color definitions. 155 <p> 156 * @return pointer to the list of color definitions. 157 */ public 158 ListOfColorDefinitions getListOfColorDefinitions() { 159 long cPtr = libsbmlJNI.RenderInformationBase_getListOfColorDefinitions__SWIG_0(swigCPtr, this); 160 return (cPtr == 0) ? null : new ListOfColorDefinitions(cPtr, false); 161 } 162 163 164/** 165 * Returns a pointer to the color definition with the given index, or <code>null</code> 166 * if the index is invalid. 167 <p> 168 * @param index of the {@link ColorDefinition} object to be returned 169 <p> 170 * @return pointer to the {@link ColorDefinition} object at the given index or null 171 */ public 172 ColorDefinition getColorDefinition(long index) { 173 long cPtr = libsbmlJNI.RenderInformationBase_getColorDefinition__SWIG_0(swigCPtr, this, index); 174 return (cPtr == 0) ? null : new ColorDefinition(cPtr, false); 175 } 176 177 178/** 179 * Returns a pointer to the color definition with the given <code>id</code>, or <code>null</code> 180 * if there is no color definition with that id. 181 <p> 182 * @param id of the color definition object to be returned. 183 <p> 184 * @return a pointer to the color definition object with the given <code>id</code> 185 * or null if there is no color definition with given <code>id</code> 186 */ public 187 ColorDefinition getColorDefinition(String id) { 188 long cPtr = libsbmlJNI.RenderInformationBase_getColorDefinition__SWIG_2(swigCPtr, this, id); 189 return (cPtr == 0) ? null : new ColorDefinition(cPtr, false); 190 } 191 192 193/** 194 * Creates a new color definition object without an id. 195 * For the object to be valid an id has to be set that is unique 196 * within the list of color definitions and the list of gradients within 197 * the render information. 198 <p> 199 * The created {@link ColorDefinition} object is added to and owned by the render information. 200 <p> 201 * @return pointer to new {@link ColorDefinition} object 202 */ public 203 ColorDefinition createColorDefinition() { 204 long cPtr = libsbmlJNI.RenderInformationBase_createColorDefinition(swigCPtr, this); 205 return (cPtr == 0) ? null : new ColorDefinition(cPtr, false); 206 } 207 208 209/** 210 * Removes the color definition with the given index from the list of color definitions. 211 * If the index is valid, the object is removed and a pointer to the removed object 212 * is returned. 213 * The caller is responsible for deleting thew object. 214 * If the index is invalid, <code>null</code> is returned. 215 <p> 216 * @param index index of the color definition to be removed. 217 <p> 218 * @ return pointer to the removed object 219 */ public 220 ColorDefinition removeColorDefinition(long index) { 221 long cPtr = libsbmlJNI.RenderInformationBase_removeColorDefinition(swigCPtr, this, index); 222 return (cPtr == 0) ? null : new ColorDefinition(cPtr, false); 223 } 224 225 226/** 227 * Adds a copy of the given color definition to the end of the list of 228 * color definitions. 229 <p> 230 * The color definition has to be valid, i.e. have a unique id and a valid color value. 231 * Otherwise it is not added. 232 <p> 233 * @param cd const pointer to {@link ColorDefinition} object to be added 234 <p> 235 * @return integer value indicating success/failure of the 236 * function. The possible values 237 * returned by this function are: 238 * <ul> 239 * <li> LIBSBML_OPERATION_SUCCESS 240 * <li> LIBSBML_LEVEL_MISMATCH 241 * <li> LIBSBML_VERSION_MISMATCH 242 * <li> LIBSBML_OPERATION_FAILED 243 * 244 * </ul> <p> 245 * @note This method should be used with some caution. The fact that 246 * this method <em>copies</em> the object passed to it means that the caller 247 * will be left holding a physically different object instance than the 248 * one contained in this {@link Reaction}. Changes made to the original object 249 * instance (such as resetting attribute values) will <em>not affect the 250 * instance in the {@link Reaction}</em>. In addition, the caller should make 251 * sure to free the original object if it is no longer being used, or 252 * else a memory leak will result. Please see {@link RenderInformationBase#createColorDefinition()} 253 * for a method that does not lead to these issues. 254 <p> 255 * @see #createColorDefinition() 256 */ public 257 int addColorDefinition(ColorDefinition cd) { 258 return libsbmlJNI.RenderInformationBase_addColorDefinition(swigCPtr, this, ColorDefinition.getCPtr(cd), cd); 259 } 260 261 262/** 263 * Returns the number of gradient definitions in the render information. 264 <p> 265 * @return number of gradient definitions 266 */ public 267 long getNumGradientDefinitions() { 268 return libsbmlJNI.RenderInformationBase_getNumGradientDefinitions(swigCPtr, this); 269 } 270 271 272/** 273 * Returns a pointer to the list of gradient definitions. 274 <p> 275 * @return pointer to {@link ListOfGradientDefinitions} 276 */ public 277 ListOfGradientDefinitions getListOfGradientDefinitions() { 278 long cPtr = libsbmlJNI.RenderInformationBase_getListOfGradientDefinitions__SWIG_0(swigCPtr, this); 279 return (cPtr == 0) ? null : new ListOfGradientDefinitions(cPtr, false); 280 } 281 282 283/** 284 * Returns a pointer to the gradient definition with the given index, or <code>null</code> 285 * if the index is invalid. 286 <p> 287 * @param index index of the GradientDefinition object to be returned 288 <p> 289 * @return pointer to the GradientDefinition object with the given index or null 290 * if the index was invalid. 291 */ public 292 GradientBase getGradientDefinition(long index) { 293 return (GradientBase) libsbml.DowncastSBase(libsbmlJNI.RenderInformationBase_getGradientDefinition__SWIG_0(swigCPtr, this, index), false); 294} 295 296 297/** 298 * Returns a pointer to the gradient definition with the given <code>id</code>, or <code>null</code> 299 * if there is no gradient definition with that id. 300 <p> 301 * @param id of the gradient definition object to be returned. 302 <p> 303 * @return a pointer to the gradient definition object with the given <code>id</code> 304 * or null if there is no gradient definition with given <code>id</code> 305 */ public 306 GradientBase getGradientDefinition(String id) { 307 return (GradientBase) libsbml.DowncastSBase(libsbmlJNI.RenderInformationBase_getGradientDefinition__SWIG_2(swigCPtr, this, id), false); 308} 309 310 311/** 312 * Creates a new linear gradient definition. 313 * The newly created object is added to the render 314 * information and also owned by it. 315 <p> 316 * Since the newly created object has no id and no gradient stops, 317 * it is invalid until those things have been added. 318 <p> 319 * @return pointer to newly created {@link LinearGradient} object. 320 */ public 321 LinearGradient createLinearGradientDefinition() { 322 long cPtr = libsbmlJNI.RenderInformationBase_createLinearGradientDefinition(swigCPtr, this); 323 return (cPtr == 0) ? null : new LinearGradient(cPtr, false); 324 } 325 326 327/** 328 * Creates a new radial gradient definition. 329 * The newly created object is added to the render 330 * information and also owned by it. 331 <p> 332 * Since the newly created object has no id and no gradient stops, 333 * it is invalid until those things have been added. 334 <p> 335 * @return pointer to newly created {@link RadialGradient} object. 336 */ public 337 RadialGradient createRadialGradientDefinition() { 338 long cPtr = libsbmlJNI.RenderInformationBase_createRadialGradientDefinition(swigCPtr, this); 339 return (cPtr == 0) ? null : new RadialGradient(cPtr, false); 340 } 341 342 343/** 344 * Removes the gradient definition with the given index. 345 * If the index is valid, the object is removed and a pointer to the removed object 346 * is returned. 347 * The caller is responsible for deleting thew object. 348 * If the index is invalid, <code>null</code> is returned. 349 <p> 350 * @param index index of the gradient definition object to be removed. 351 <p> 352 * @ return pointer to the removed object 353 */ public 354 GradientBase removeGradientDefinition(long index) { 355 return (GradientBase) libsbml.DowncastSBase(libsbmlJNI.RenderInformationBase_removeGradientDefinition(swigCPtr, this, index), false); 356} 357 358 359/** 360 * Adds a copy of the given gradient definition to the end of the list of 361 * gradient definitions. 362 * The Gradient definition has to be valid, so is has to have at least two 363 * gradient stops and an id. 364 <p> 365 * @param gradient GradientDefinition object to be added 366 <p> 367 * @return integer value indicating success/failure of the 368 * function. The possible values 369 * returned by this function are: 370 * <ul> 371 * <li> LIBSBML_OPERATION_SUCCESS 372 * <li> LIBSBML_LEVEL_MISMATCH 373 * <li> LIBSBML_VERSION_MISMATCH 374 * <li> LIBSBML_OPERATION_FAILED 375 * 376 * </ul> <p> 377 * @note This method should be used with some caution. The fact that 378 * this method <em>copies</em> the object passed to it means that the caller 379 * will be left holding a physically different object instance than the 380 * one contained in this {@link RenderInformationBase}. Changes made to the original object 381 * instance (such as resetting attribute values) will <em>not affect the 382 * instance in the {@link RenderInformationBase}</em>. In addition, the caller should make 383 * sure to free the original object if it is no longer being used, or 384 * else a memory leak will result. Please see 385 * {@link RenderInformationBase#createLinearGradientDefinition()} or 386 * {@link RenderInformationBase#createRadialGradientDefinition()} 387 * for methods that does not lead to these issues. 388 <p> 389 * @see #createRadialGradientDefinition() 390 * @see #createLinearGradientDefinition() 391 */ public 392 int addGradientDefinition(GradientBase gradient) { 393 return libsbmlJNI.RenderInformationBase_addGradientDefinition(swigCPtr, this, GradientBase.getCPtr(gradient), gradient); 394 } 395 396 397/** 398 * Returns the number of line endings for the render information. 399 <p> 400 * @return number of line endings in the render information. 401 */ public 402 long getNumLineEndings() { 403 return libsbmlJNI.RenderInformationBase_getNumLineEndings(swigCPtr, this); 404 } 405 406 407/** 408 * Returns a pointer to the list of line endings. 409 <p> 410 * @return pointer to the list of line endings. 411 */ public 412 ListOfLineEndings getListOfLineEndings() { 413 long cPtr = libsbmlJNI.RenderInformationBase_getListOfLineEndings__SWIG_0(swigCPtr, this); 414 return (cPtr == 0) ? null : new ListOfLineEndings(cPtr, false); 415 } 416 417 418/** 419 * Returns a pointer to the line ending with the given index, or <code>null</code> 420 * if the index is invalid. 421 <p> 422 * @param index of the line ending object to be returned. 423 <p> 424 * @return a pointer to the line ending object with the given index 425 * or null if the index was out of bounds. 426 */ public 427 LineEnding getLineEnding(long index) { 428 long cPtr = libsbmlJNI.RenderInformationBase_getLineEnding__SWIG_0(swigCPtr, this, index); 429 return (cPtr == 0) ? null : new LineEnding(cPtr, false); 430 } 431 432 433/** 434 * Returns a pointer to the line ending with the given <code>id</code>, or <code>null</code> 435 * if there is no line ending with that id. 436 <p> 437 * @param id of the line ending object to be returned. 438 <p> 439 * @return a pointer to the line ending object with the given <code>id</code> 440 * or null if there is no line ending with given <code>id</code> 441 */ public 442 LineEnding getLineEnding(String id) { 443 long cPtr = libsbmlJNI.RenderInformationBase_getLineEnding__SWIG_2(swigCPtr, this, id); 444 return (cPtr == 0) ? null : new LineEnding(cPtr, false); 445 } 446 447 448/** 449 * Creates a new line ending. 450 * The new line ending object is added to and owned by the 451 * render information. Since it does not have an id or a valid group 452 * or a valid viewport, it should be considered invalid until those 453 * things have been set. 454 <p> 455 * @return pointer to the newlyy created {@link LineEnding} object 456 */ public 457 LineEnding createLineEnding() { 458 long cPtr = libsbmlJNI.RenderInformationBase_createLineEnding(swigCPtr, this); 459 return (cPtr == 0) ? null : new LineEnding(cPtr, false); 460 } 461 462 463/** 464 * Removes the line ending with the given index. 465 * If the index is valid, the object is removed and a pointer to the removed object 466 * is returned. 467 * The caller is responsible for deleting thew object. 468 * If the index is invalid, <code>null</code> is returned. 469 <p> 470 * @param index index of the object to be removed. 471 <p> 472 * @ return pointer to the removed object 473 */ public 474 LineEnding removeLineEnding(long index) { 475 long cPtr = libsbmlJNI.RenderInformationBase_removeLineEnding(swigCPtr, this, index); 476 return (cPtr == 0) ? null : new LineEnding(cPtr, false); 477 } 478 479 480/** 481 * Adds a copy of the given line ending to the end of the list of line 482 * endings. 483 * The new {@link LineEnding} is only added if it is valid. 484 <p> 485 * @param le const pointer to {@link LineEnding} to be added 486 <p> 487 * @return integer value indicating success/failure of the 488 * function. The possible values 489 * returned by this function are: 490 * <ul> 491 * <li> LIBSBML_OPERATION_SUCCESS 492 * <li> LIBSBML_LEVEL_MISMATCH 493 * <li> LIBSBML_VERSION_MISMATCH 494 * <li> LIBSBML_OPERATION_FAILED 495 * 496 * </ul> <p> 497 * @note This method should be used with some caution. The fact that 498 * this method <em>copies</em> the object passed to it means that the caller 499 * will be left holding a physically different object instance than the 500 * one contained in this {@link RenderInformationBase}. Changes made to the original object 501 * instance (such as resetting attribute values) will <em>not affect the 502 * instance in the {@link RenderInformationBase}</em>. In addition, the caller should make 503 * sure to free the original object if it is no longer being used, or 504 * else a memory leak will result. Please see {@link RenderInformationBase#createLineEnding()} 505 * for a method that does not lead to these issues. 506 <p> 507 * @see #createLineEnding() 508 */ public 509 int addLineEnding(LineEnding le) { 510 return libsbmlJNI.RenderInformationBase_addLineEnding(swigCPtr, this, LineEnding.getCPtr(le), le); 511 } 512 513 514/** 515 * Returns the background color which is either the id of a color in the 516 * list of color definitions, or a color value. 517 <p> 518 * @return background color id or value string 519 */ public 520 String getBackgroundColor() { 521 return libsbmlJNI.RenderInformationBase_getBackgroundColor(swigCPtr, this); 522 } 523 524 525/** 526 * Sets the background color to either the id of a color in the list of 527 * color definitions, or a color value. 528 <p> 529 * @param bg id of a color definition or a valid color value to be used as background color. 530 */ public 531 void setBackgroundColor(String bg) { 532 libsbmlJNI.RenderInformationBase_setBackgroundColor(swigCPtr, this, bg); 533 } 534 535 536/** 537 * Returns the value of the 'id' attribute of this {@link RenderInformationBase}. 538 <p> 539 * @return the id of the {@link RenderInformationBase} 540 */ public 541 String getId() { 542 return libsbmlJNI.RenderInformationBase_getId(swigCPtr, this); 543 } 544 545 546/** 547 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 548 * {@link RenderInformationBase}'s 'id' attribute has been set. 549 <p> 550 * @return returns true or false depending on whether the id on the 551 * {@link RenderInformationBase} has been set. 552 */ public 553 boolean isSetId() { 554 return libsbmlJNI.RenderInformationBase_isSetId(swigCPtr, this); 555 } 556 557 558/** 559 * Sets the value of the 'id' attribute of this {@link RenderInformationBase}. 560 <p> 561 * @param id the new id for the {@link RenderInformationBase} 562 <p> 563 * @return status if the operation succeeded 564 */ public 565 int setId(String id) { 566 return libsbmlJNI.RenderInformationBase_setId(swigCPtr, this, id); 567 } 568 569 570/** 571 * Unsets the value of the 'id' attribute of this {@link RenderInformationBase}. 572 */ public 573 int unsetId() { 574 return libsbmlJNI.RenderInformationBase_unsetId(swigCPtr, this); 575 } 576 577 578/** 579 * Returns the value of the 'name' attribute of this {@link RenderInformationBase}. 580 <p> 581 * @return the name of the {@link RenderInformationBase} 582 */ public 583 String getName() { 584 return libsbmlJNI.RenderInformationBase_getName(swigCPtr, this); 585 } 586 587 588/** 589 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 590 * {@link RenderInformationBase}'s 'name' attribute has been set. 591 <p> 592 * @return returns true or false depending on whether the name on the 593 * {@link RenderInformationBase} has been set. 594 */ public 595 boolean isSetName() { 596 return libsbmlJNI.RenderInformationBase_isSetName(swigCPtr, this); 597 } 598 599 600/** 601 * Sets the value of the 'name' attribute of this {@link RenderInformationBase}. 602 <p> 603 * @param name the new name for the {@link RenderInformationBase} 604 <p> 605 * @return status if the operation succeeded 606 */ public 607 int setName(String id) { 608 return libsbmlJNI.RenderInformationBase_setName(swigCPtr, this, id); 609 } 610 611 612/** 613 * Unsets the value of the 'name' attribute of this {@link RenderInformationBase}. 614 */ public 615 int unsetName() { 616 return libsbmlJNI.RenderInformationBase_unsetName(swigCPtr, this); 617 } 618 619 620/** 621 * Sets this SBML object to child SBML objects (if any). 622 * (Creates a child-parent relationship by the parent) 623 <p> 624 * Subclasses must override this function if they define 625 * one ore more child elements. 626 * Basically, this function needs to be called in 627 * constructor, copy constructor, assignment operator. 628 <p> 629 * @see setSBMLDocument 630 * @see enablePackageInternal 631 * @internal 632 */ public 633 void connectToChild() { 634 libsbmlJNI.RenderInformationBase_connectToChild(swigCPtr, this); 635 } 636 637 638/** 639 * Enables/Disables the given package with this element and child 640 * elements (if any). 641 * (This is an internal implementation for enablePakcage function) 642 <p> 643 * @note Subclasses in which one or more child elements are defined 644 * must override this function. 645 * @internal 646 */ public 647 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 648 libsbmlJNI.RenderInformationBase_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 649 } 650 651}