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 class of objects that store layouts. 015 <p> 016 * All the more specific layout elements (CompartmentGlyph, {@link GeneralGlyph}, 017 * {@link SpeciesGlyph}, {@link ReactionGlyph}, {@link ReferenceGlyph}, {@link TextGlyph}, and 018 * {@link SpeciesReferenceGlyph}) are derived from the class {@link GraphicalObject}. Each 019 * object of class {@link GraphicalObject} has a mandatory {@link BoundingBox}, which 020 * specifies the position and the size of the object. While {@link GraphicalObject} 021 * is the base class for most elements in the “layout” package, 022 * it is not an abstract class. It can be instantiated when used in the 023 * listOfAdditionalGraphicalObjects to describe additional elements and 024 * relationships. Since it only describes a {@link BoundingBox}, programs are 025 * encouraged to add Annotation objects that describe program-specific 026 * graphical information. 027 */ 028 029public class GraphicalObject extends SBase { 030 private long swigCPtr; 031 032 protected GraphicalObject(long cPtr, boolean cMemoryOwn) 033 { 034 super(libsbmlJNI.GraphicalObject_SWIGUpcast(cPtr), cMemoryOwn); 035 swigCPtr = cPtr; 036 } 037 038 protected static long getCPtr(GraphicalObject obj) 039 { 040 return (obj == null) ? 0 : obj.swigCPtr; 041 } 042 043 protected static long getCPtrAndDisown (GraphicalObject obj) 044 { 045 long ptr = 0; 046 047 if (obj != null) 048 { 049 ptr = obj.swigCPtr; 050 obj.swigCMemOwn = false; 051 } 052 053 return ptr; 054 } 055 056 protected void finalize() { 057 delete(); 058 } 059 060 public synchronized void delete() { 061 if (swigCPtr != 0) { 062 if (swigCMemOwn) { 063 swigCMemOwn = false; 064 libsbmlJNI.delete_GraphicalObject(swigCPtr); 065 } 066 swigCPtr = 0; 067 } 068 super.delete(); 069 } 070 071 072/** 073 * Creates a new {@link GraphicalObject}. 074 <p> 075 * @param level the SBML Level. 076 * @param version the Version within the SBML Level. 077 * @param pkgVersion the version of the package. 078 <p> 079 * <p> 080 * @note Attempting to add an object to an {@link SBMLDocument} having a different 081 * combination of SBML Level, Version and XML namespaces than the object 082 * itself will result in an error at the time a caller attempts to make the 083 * addition. A parent object must have compatible Level, Version and XML 084 * namespaces. (Strictly speaking, a parent may also have more XML 085 * namespaces than a child, but the reverse is not permitted.) The 086 * restriction is necessary to ensure that an SBML model has a consistent 087 * overall structure. This requires callers to manage their objects 088 * carefully, but the benefit is increased flexibility in how models can be 089 * created by permitting callers to create objects bottom-up if desired. In 090 * situations where objects are not yet attached to parents (e.g., 091 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 092 * libSBML determine such things as whether it is valid to assign a 093 * particular value to an attribute. For packages, this means that the 094 * parent object to which this package element is being added must have 095 * been created with the package namespace, or that the package namespace 096 * was added to it, even if that parent is not a package object itself. 097 */ public 098 GraphicalObject(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 099 this(libsbmlJNI.new_GraphicalObject__SWIG_0(level, version, pkgVersion), true); 100 } 101 102 103/** 104 * Creates a new {@link GraphicalObject}. 105 <p> 106 * @param level the SBML Level. 107 * @param version the Version within the SBML Level. 108 * @param pkgVersion the version of the package. 109 <p> 110 * <p> 111 * @note Attempting to add an object to an {@link SBMLDocument} having a different 112 * combination of SBML Level, Version and XML namespaces than the object 113 * itself will result in an error at the time a caller attempts to make the 114 * addition. A parent object must have compatible Level, Version and XML 115 * namespaces. (Strictly speaking, a parent may also have more XML 116 * namespaces than a child, but the reverse is not permitted.) The 117 * restriction is necessary to ensure that an SBML model has a consistent 118 * overall structure. This requires callers to manage their objects 119 * carefully, but the benefit is increased flexibility in how models can be 120 * created by permitting callers to create objects bottom-up if desired. In 121 * situations where objects are not yet attached to parents (e.g., 122 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 123 * libSBML determine such things as whether it is valid to assign a 124 * particular value to an attribute. For packages, this means that the 125 * parent object to which this package element is being added must have 126 * been created with the package namespace, or that the package namespace 127 * was added to it, even if that parent is not a package object itself. 128 */ public 129 GraphicalObject(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 130 this(libsbmlJNI.new_GraphicalObject__SWIG_1(level, version), true); 131 } 132 133 134/** 135 * Creates a new {@link GraphicalObject}. 136 <p> 137 * @param level the SBML Level. 138 * @param version the Version within the SBML Level. 139 * @param pkgVersion the version of the package. 140 <p> 141 * <p> 142 * @note Attempting to add an object to an {@link SBMLDocument} having a different 143 * combination of SBML Level, Version and XML namespaces than the object 144 * itself will result in an error at the time a caller attempts to make the 145 * addition. A parent object must have compatible Level, Version and XML 146 * namespaces. (Strictly speaking, a parent may also have more XML 147 * namespaces than a child, but the reverse is not permitted.) The 148 * restriction is necessary to ensure that an SBML model has a consistent 149 * overall structure. This requires callers to manage their objects 150 * carefully, but the benefit is increased flexibility in how models can be 151 * created by permitting callers to create objects bottom-up if desired. In 152 * situations where objects are not yet attached to parents (e.g., 153 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 154 * libSBML determine such things as whether it is valid to assign a 155 * particular value to an attribute. For packages, this means that the 156 * parent object to which this package element is being added must have 157 * been created with the package namespace, or that the package namespace 158 * was added to it, even if that parent is not a package object itself. 159 */ public 160 GraphicalObject(long level) throws org.sbml.libsbml.SBMLConstructorException { 161 this(libsbmlJNI.new_GraphicalObject__SWIG_2(level), true); 162 } 163 164 165/** 166 * Creates a new {@link GraphicalObject}. 167 <p> 168 * @param level the SBML Level. 169 * @param version the Version within the SBML Level. 170 * @param pkgVersion the version of the package. 171 <p> 172 * <p> 173 * @note Attempting to add an object to an {@link SBMLDocument} having a different 174 * combination of SBML Level, Version and XML namespaces than the object 175 * itself will result in an error at the time a caller attempts to make the 176 * addition. A parent object must have compatible Level, Version and XML 177 * namespaces. (Strictly speaking, a parent may also have more XML 178 * namespaces than a child, but the reverse is not permitted.) The 179 * restriction is necessary to ensure that an SBML model has a consistent 180 * overall structure. This requires callers to manage their objects 181 * carefully, but the benefit is increased flexibility in how models can be 182 * created by permitting callers to create objects bottom-up if desired. In 183 * situations where objects are not yet attached to parents (e.g., 184 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 185 * libSBML determine such things as whether it is valid to assign a 186 * particular value to an attribute. For packages, this means that the 187 * parent object to which this package element is being added must have 188 * been created with the package namespace, or that the package namespace 189 * was added to it, even if that parent is not a package object itself. 190 */ public 191 GraphicalObject() throws org.sbml.libsbml.SBMLConstructorException { 192 this(libsbmlJNI.new_GraphicalObject__SWIG_3(), true); 193 } 194 195 196/** 197 * Creates a new {@link GraphicalObject} with the given {@link LayoutPkgNamespaces} 198 <p> 199 * <p> 200 * The package namespaces object used in this constructor is derived from a 201 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 202 * information. It is used to communicate the SBML Level, Version, and 203 * package version and name information used in addition to SBML Level 3 Core. A 204 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 205 * package namespace object somewhere in a program once, then hand that object 206 * as needed to object constructors of that package that accept it as and 207 * argument, such as this one. 208 <p> 209 * @param layoutns the {@link LayoutPkgNamespaces} object. 210 <p> 211 * <p> 212 * @note Attempting to add an object to an {@link SBMLDocument} having a different 213 * combination of SBML Level, Version and XML namespaces than the object 214 * itself will result in an error at the time a caller attempts to make the 215 * addition. A parent object must have compatible Level, Version and XML 216 * namespaces. (Strictly speaking, a parent may also have more XML 217 * namespaces than a child, but the reverse is not permitted.) The 218 * restriction is necessary to ensure that an SBML model has a consistent 219 * overall structure. This requires callers to manage their objects 220 * carefully, but the benefit is increased flexibility in how models can be 221 * created by permitting callers to create objects bottom-up if desired. In 222 * situations where objects are not yet attached to parents (e.g., 223 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 224 * libSBML determine such things as whether it is valid to assign a 225 * particular value to an attribute. For packages, this means that the 226 * parent object to which this package element is being added must have 227 * been created with the package namespace, or that the package namespace 228 * was added to it, even if that parent is not a package object itself. 229 */ public 230 GraphicalObject(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 231 this(libsbmlJNI.new_GraphicalObject__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 232 } 233 234 235/** 236 * Creates a new {@link GraphicalObject} with the given <code>id</code>. 237 <p> 238 * (FOR BACKWARD COMPATIBILITY) 239 */ public 240 GraphicalObject(LayoutPkgNamespaces layoutns, String id) throws org.sbml.libsbml.SBMLConstructorException { 241 this(libsbmlJNI.new_GraphicalObject__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id), true); 242 } 243 244 245/** 246 * Creates a new {@link GraphicalObject} with the given <code>id</code> and 2D coordinates for 247 * the bounding box. 248 <p> 249 * (FOR BACKWARD COMPATIBILITY) 250 */ public 251 GraphicalObject(LayoutPkgNamespaces layoutns, String id, double x, double y, double w, double h) throws org.sbml.libsbml.SBMLConstructorException { 252 this(libsbmlJNI.new_GraphicalObject__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, x, y, w, h), true); 253 } 254 255 256/** 257 * Creates a new {@link GraphicalObject} with the given <code>id</code> and 3D coordinates for 258 * the bounding box. 259 <p> 260 * (FOR BACKWARD COMPATIBILITY) 261 */ public 262 GraphicalObject(LayoutPkgNamespaces layoutns, String id, double x, double y, double z, double w, double h, double d) throws org.sbml.libsbml.SBMLConstructorException { 263 this(libsbmlJNI.new_GraphicalObject__SWIG_7(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, x, y, z, w, h, d), true); 264 } 265 266 267/** 268 * Creates a new {@link GraphicalObject} with the given <code>id</code> and 3D coordinates for 269 * the bounding box. 270 <p> 271 * (FOR BACKWARD COMPATIBILITY) 272 */ public 273 GraphicalObject(LayoutPkgNamespaces layoutns, String id, Point p, Dimensions d) throws org.sbml.libsbml.SBMLConstructorException { 274 this(libsbmlJNI.new_GraphicalObject__SWIG_8(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, Point.getCPtr(p), p, Dimensions.getCPtr(d), d), true); 275 } 276 277 278/** 279 * Creates a new {@link GraphicalObject} with the given <code>id</code> and 3D coordinates for 280 * the bounding box. 281 <p> 282 * (FOR BACKWARD COMPATIBILITY) 283 */ public 284 GraphicalObject(LayoutPkgNamespaces layoutns, String id, BoundingBox bb) throws org.sbml.libsbml.SBMLConstructorException { 285 this(libsbmlJNI.new_GraphicalObject__SWIG_9(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, BoundingBox.getCPtr(bb), bb), true); 286 } 287 288 289/** 290 * Creates a new {@link GraphicalObject} from the given {@link XMLNode} 291 <p> 292 * (FOR BACKWARD COMPATIBILITY) 293 */ public 294 GraphicalObject(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 295 this(libsbmlJNI.new_GraphicalObject__SWIG_10(XMLNode.getCPtr(node), node, l2version), true); 296 } 297 298 299/** 300 * Creates a new {@link GraphicalObject} from the given {@link XMLNode} 301 <p> 302 * (FOR BACKWARD COMPATIBILITY) 303 */ public 304 GraphicalObject(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 305 this(libsbmlJNI.new_GraphicalObject__SWIG_11(XMLNode.getCPtr(node), node), true); 306 } 307 308 309/** 310 * Copy constructor. 311 <p> 312 * @param source the instance to copy. 313 */ public 314 GraphicalObject(GraphicalObject source) throws org.sbml.libsbml.SBMLConstructorException { 315 this(libsbmlJNI.new_GraphicalObject__SWIG_12(GraphicalObject.getCPtr(source), source), true); 316 } 317 318 319/** 320 * Does nothing. No defaults are defined for {@link GraphicalObject}. 321 */ public 322 void initDefaults() { 323 libsbmlJNI.GraphicalObject_initDefaults(swigCPtr, this); 324 } 325 326 327/** 328 * Renames all the <code>MetaIdRef</code> attributes on this element. 329 <p> 330 * This method works by looking at all meta-attribute values, comparing 331 * the identifiers to the value of <code>oldid</code>. If any matches are found, 332 * the matching identifiers are replaced with <code>newid</code>. The method does 333 * <em>not</em> descend into child elements. 334 <p> 335 * @param oldid the old identifier. 336 * @param newid the new identifier. 337 */ public 338 void renameMetaIdRefs(String oldid, String newid) { 339 libsbmlJNI.GraphicalObject_renameMetaIdRefs(swigCPtr, this, oldid, newid); 340 } 341 342 343/** 344 * Returns the value of the 'id' attribute of this {@link GraphicalObject}. 345 <p> 346 * @note Because of the inconsistent behavior of this function with 347 * respect to assignments and rules, it is now recommended to 348 * use the getIdAttribute() function instead. 349 <p> 350 * <p> 351 * The identifier given by an object's 'id' attribute value 352 * is used to identify the object within the SBML model definition. 353 * Other objects can refer to the component using this identifier. The 354 * data type of 'id' is always <code>SId</code> or a type derived 355 * from that, such as <code>UnitSId</code>, depending on the object in 356 * question. All data types are defined as follows: 357 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 358 * letter .= 'a'..'z','A'..'Z' 359 * digit .= '0'..'9' 360 * idChar .= letter | digit | '_' 361 * SId .= ( letter | '_' ) idChar* 362 * </pre> 363 <p> 364 * The characters <code>(</code> and <code>)</code> are used for grouping, the 365 * character <code>*</code> 'zero or more times', and the character 366 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 367 * determined by an exact character sequence match; i.e., comparisons must be 368 * performed in a case-sensitive manner. This applies to all uses of <code>SId</code>, 369 * <code>SIdRef</code>, and derived types. 370 <p> 371 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 372 * moved to {@link SBase} directly, instead of being defined individually for many 373 * (but not all) objects. Libsbml has for a long time provided functions 374 * defined on {@link SBase} itself to get, set, check, and unset those attributes, which 375 * would fail or otherwise return empty strings if executed on any object 376 * for which those attributes were not defined. Now that all {@link SBase} objects 377 * define those attributes, those functions now succeed for any object with 378 * the appropriate level and version. 379 <p> 380 * The exception to this rule is that for {@link InitialAssignment}, {@link EventAssignment}, 381 * {@link AssignmentRule}, and {@link RateRule} objects, the getId() function and the isSetId() 382 * functions (though not the setId() or unsetId() functions) would instead 383 * reference the value of the 'variable' attribute (for the rules and event 384 * assignments) or the 'symbol' attribute (for initial assignments). 385 * The {@link AlgebraicRule} fell into this category as well, though because it 386 * contained neither a 'variable' nor a 'symbol' attribute, getId() would 387 * always return an empty string, and isSetId() would always return <code>false.</code> 388 * For this reason, four new functions are now provided 389 * (getIdAttribute(), setIdAttribute(String), 390 * isSetIdAttribute(), and unsetIdAttribute()) that will always 391 * act on the actual 'id' attribute, regardless of the object's type. The 392 * new functions should be used instead of the old ones unless the old behavior 393 * is somehow necessary. 394 <p> 395 * Regardless of the level and version of the SBML, these functions allow 396 * client applications to use more generalized code in some situations 397 * (for instance, when manipulating objects that are all known to have 398 * identifiers). If the object in question does not posess an 'id' attribute 399 * according to the SBML specification for the Level and Version in use, 400 * libSBML will not allow the identifier to be set, nor will it read or 401 * write 'id' attributes for those objects. 402 <p> 403 * @return the id of this {@link GraphicalObject}. 404 <p> 405 * @see #getIdAttribute() 406 * @see #setIdAttribute(String sid) 407 * @see #isSetIdAttribute() 408 * @see #unsetIdAttribute() 409 */ public 410 String getId() { 411 return libsbmlJNI.GraphicalObject_getId(swigCPtr, this); 412 } 413 414 415/** 416 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 417 * {@link GraphicalObject}'s 'id' attribute has been set. 418 <p> 419 * <p> 420 * @note Because of the inconsistent behavior of this function with 421 * respect to assignments and rules, it is now recommended to 422 * use the isSetIdAttribute() function instead. 423 <p> 424 * <p> 425 * The identifier given by an object's 'id' attribute value 426 * is used to identify the object within the SBML model definition. 427 * Other objects can refer to the component using this identifier. The 428 * data type of 'id' is always <code>SId</code> or a type derived 429 * from that, such as <code>UnitSId</code>, depending on the object in 430 * question. All data types are defined as follows: 431 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 432 * letter .= 'a'..'z','A'..'Z' 433 * digit .= '0'..'9' 434 * idChar .= letter | digit | '_' 435 * SId .= ( letter | '_' ) idChar* 436 * </pre> 437 <p> 438 * The characters <code>(</code> and <code>)</code> are used for grouping, the 439 * character <code>*</code> 'zero or more times', and the character 440 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 441 * determined by an exact character sequence match; i.e., comparisons must be 442 * performed in a case-sensitive manner. This applies to all uses of <code>SId</code>, 443 * <code>SIdRef</code>, and derived types. 444 <p> 445 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 446 * moved to {@link SBase} directly, instead of being defined individually for many 447 * (but not all) objects. Libsbml has for a long time provided functions 448 * defined on {@link SBase} itself to get, set, check, and unset those attributes, which 449 * would fail or otherwise return empty strings if executed on any object 450 * for which those attributes were not defined. Now that all {@link SBase} objects 451 * define those attributes, those functions now succeed for any object with 452 * the appropriate level and version. 453 <p> 454 * The exception to this rule is that for {@link InitialAssignment}, {@link EventAssignment}, 455 * {@link AssignmentRule}, and {@link RateRule} objects, the getId() function and the isSetId() 456 * functions (though not the setId() or unsetId() functions) would instead 457 * reference the value of the 'variable' attribute (for the rules and event 458 * assignments) or the 'symbol' attribute (for initial assignments). 459 * The {@link AlgebraicRule} fell into this category as well, though because it 460 * contained neither a 'variable' nor a 'symbol' attribute, getId() would 461 * always return an empty string, and isSetId() would always return <code>false.</code> 462 * For this reason, four new functions are now provided 463 * (getIdAttribute(), setIdAttribute(String), 464 * isSetIdAttribute(), and unsetIdAttribute()) that will always 465 * act on the actual 'id' attribute, regardless of the object's type. The 466 * new functions should be used instead of the old ones unless the old behavior 467 * is somehow necessary. 468 <p> 469 * Regardless of the level and version of the SBML, these functions allow 470 * client applications to use more generalized code in some situations 471 * (for instance, when manipulating objects that are all known to have 472 * identifiers). If the object in question does not posess an 'id' attribute 473 * according to the SBML specification for the Level and Version in use, 474 * libSBML will not allow the identifier to be set, nor will it read or 475 * write 'id' attributes for those objects. 476 <p> 477 * @return <code>true</code> if the 'id' attribute of this SBML object is 478 * set, <code>false</code> otherwise. 479 <p> 480 * @see #getIdAttribute() 481 * @see #setIdAttribute(String sid) 482 * @see #unsetIdAttribute() 483 * @see #isSetIdAttribute() 484 */ public 485 boolean isSetId() { 486 return libsbmlJNI.GraphicalObject_isSetId(swigCPtr, this); 487 } 488 489 490/** 491 * Sets the value of the 'id' attribute of this {@link GraphicalObject}. 492 <p> 493 * <p> 494 * The string <code>sid</code> is copied. 495 <p> 496 * <p> 497 * The identifier given by an object's 'id' attribute value 498 * is used to identify the object within the SBML model definition. 499 * Other objects can refer to the component using this identifier. The 500 * data type of 'id' is always <code>SId</code> or a type derived 501 * from that, such as <code>UnitSId</code>, depending on the object in 502 * question. All data types are defined as follows: 503 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 504 * letter .= 'a'..'z','A'..'Z' 505 * digit .= '0'..'9' 506 * idChar .= letter | digit | '_' 507 * SId .= ( letter | '_' ) idChar* 508 * </pre> 509 <p> 510 * The characters <code>(</code> and <code>)</code> are used for grouping, the 511 * character <code>*</code> 'zero or more times', and the character 512 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 513 * determined by an exact character sequence match; i.e., comparisons must be 514 * performed in a case-sensitive manner. This applies to all uses of <code>SId</code>, 515 * <code>SIdRef</code>, and derived types. 516 <p> 517 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 518 * moved to {@link SBase} directly, instead of being defined individually for many 519 * (but not all) objects. Libsbml has for a long time provided functions 520 * defined on {@link SBase} itself to get, set, check, and unset those attributes, which 521 * would fail or otherwise return empty strings if executed on any object 522 * for which those attributes were not defined. Now that all {@link SBase} objects 523 * define those attributes, those functions now succeed for any object with 524 * the appropriate level and version. 525 <p> 526 * The exception to this rule is that for {@link InitialAssignment}, {@link EventAssignment}, 527 * {@link AssignmentRule}, and {@link RateRule} objects, the getId() function and the isSetId() 528 * functions (though not the setId() or unsetId() functions) would instead 529 * reference the value of the 'variable' attribute (for the rules and event 530 * assignments) or the 'symbol' attribute (for initial assignments). 531 * The {@link AlgebraicRule} fell into this category as well, though because it 532 * contained neither a 'variable' nor a 'symbol' attribute, getId() would 533 * always return an empty string, and isSetId() would always return <code>false.</code> 534 * For this reason, four new functions are now provided 535 * (getIdAttribute(), setIdAttribute(String), 536 * isSetIdAttribute(), and unsetIdAttribute()) that will always 537 * act on the actual 'id' attribute, regardless of the object's type. The 538 * new functions should be used instead of the old ones unless the old behavior 539 * is somehow necessary. 540 <p> 541 * Regardless of the level and version of the SBML, these functions allow 542 * client applications to use more generalized code in some situations 543 * (for instance, when manipulating objects that are all known to have 544 * identifiers). If the object in question does not posess an 'id' attribute 545 * according to the SBML specification for the Level and Version in use, 546 * libSBML will not allow the identifier to be set, nor will it read or 547 * write 'id' attributes for those objects. 548 <p> 549 * @param sid the string to use as the identifier of this object. 550 <p> 551 * <p> 552 * @return integer value indicating success/failure of the 553 * function. The possible values 554 * returned by this function are: 555 * <ul> 556 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 557 * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE} 558 * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE} 559 * 560 * </ul> <p> 561 * @see #getIdAttribute() 562 * @see #setIdAttribute(String sid) 563 * @see #isSetIdAttribute() 564 * @see #unsetIdAttribute() 565 */ public 566 int setId(String sid) { 567 return libsbmlJNI.GraphicalObject_setId(swigCPtr, this, sid); 568 } 569 570 571/** 572 * Unsets the value of the 'id' attribute of this {@link GraphicalObject}. 573 <p> 574 * <p> 575 * <p> 576 * The identifier given by an object's 'id' attribute value 577 * is used to identify the object within the SBML model definition. 578 * Other objects can refer to the component using this identifier. The 579 * data type of 'id' is always <code>SId</code> or a type derived 580 * from that, such as <code>UnitSId</code>, depending on the object in 581 * question. All data types are defined as follows: 582 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 583 * letter .= 'a'..'z','A'..'Z' 584 * digit .= '0'..'9' 585 * idChar .= letter | digit | '_' 586 * SId .= ( letter | '_' ) idChar* 587 * </pre> 588 <p> 589 * The characters <code>(</code> and <code>)</code> are used for grouping, the 590 * character <code>*</code> 'zero or more times', and the character 591 * <code>|</code> indicates logical 'or'. The equality of SBML identifiers is 592 * determined by an exact character sequence match; i.e., comparisons must be 593 * performed in a case-sensitive manner. This applies to all uses of <code>SId</code>, 594 * <code>SIdRef</code>, and derived types. 595 <p> 596 * In SBML Level 3 Version 2, the 'id' and 'name' attributes were 597 * moved to {@link SBase} directly, instead of being defined individually for many 598 * (but not all) objects. Libsbml has for a long time provided functions 599 * defined on {@link SBase} itself to get, set, check, and unset those attributes, which 600 * would fail or otherwise return empty strings if executed on any object 601 * for which those attributes were not defined. Now that all {@link SBase} objects 602 * define those attributes, those functions now succeed for any object with 603 * the appropriate level and version. 604 <p> 605 * The exception to this rule is that for {@link InitialAssignment}, {@link EventAssignment}, 606 * {@link AssignmentRule}, and {@link RateRule} objects, the getId() function and the isSetId() 607 * functions (though not the setId() or unsetId() functions) would instead 608 * reference the value of the 'variable' attribute (for the rules and event 609 * assignments) or the 'symbol' attribute (for initial assignments). 610 * The {@link AlgebraicRule} fell into this category as well, though because it 611 * contained neither a 'variable' nor a 'symbol' attribute, getId() would 612 * always return an empty string, and isSetId() would always return <code>false.</code> 613 * For this reason, four new functions are now provided 614 * (getIdAttribute(), setIdAttribute(String), 615 * isSetIdAttribute(), and unsetIdAttribute()) that will always 616 * act on the actual 'id' attribute, regardless of the object's type. The 617 * new functions should be used instead of the old ones unless the old behavior 618 * is somehow necessary. 619 <p> 620 * Regardless of the level and version of the SBML, these functions allow 621 * client applications to use more generalized code in some situations 622 * (for instance, when manipulating objects that are all known to have 623 * identifiers). If the object in question does not posess an 'id' attribute 624 * according to the SBML specification for the Level and Version in use, 625 * libSBML will not allow the identifier to be set, nor will it read or 626 * write 'id' attributes for those objects. 627 <p> 628 * <p> 629 * @return integer value indicating success/failure of the 630 * function. The possible values 631 * returned by this function are: 632 * <ul> 633 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS} 634 * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED} 635 * 636 * </ul> <p> 637 * @see #getIdAttribute() 638 * @see #setIdAttribute(String sid) 639 * @see #isSetIdAttribute() 640 * @see #unsetIdAttribute() 641 */ public 642 int unsetId() { 643 return libsbmlJNI.GraphicalObject_unsetId(swigCPtr, this); 644 } 645 646 647/** 648 * Returns the value of the 'metaidRef' attribute of this {@link GraphicalObject}. 649 */ public 650 String getMetaIdRef() { 651 return libsbmlJNI.GraphicalObject_getMetaIdRef(swigCPtr, this); 652 } 653 654 655/** 656 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 657 * {@link GraphicalObject}'s 'metaidRef' attribute has been set. 658 */ public 659 boolean isSetMetaIdRef() { 660 return libsbmlJNI.GraphicalObject_isSetMetaIdRef(swigCPtr, this); 661 } 662 663 664/** 665 * Sets the value of the 'metaidRef' attribute of this {@link GraphicalObject}. 666 */ public 667 int setMetaIdRef(String metaid) { 668 return libsbmlJNI.GraphicalObject_setMetaIdRef(swigCPtr, this, metaid); 669 } 670 671 672/** 673 * Unsets the value of the 'metaidRef' attribute of this {@link GraphicalObject}. 674 */ public 675 int unsetMetaIdRef() { 676 return libsbmlJNI.GraphicalObject_unsetMetaIdRef(swigCPtr, this); 677 } 678 679 680/** 681 * Sets the boundingbox for the {@link GraphicalObject}. 682 */ public 683 void setBoundingBox(BoundingBox bb) { 684 libsbmlJNI.GraphicalObject_setBoundingBox(swigCPtr, this, BoundingBox.getCPtr(bb), bb); 685 } 686 687 688/** 689 * Returns the bounding box for the {@link GraphicalObject}. 690 */ public 691 BoundingBox getBoundingBox() { 692 long cPtr = libsbmlJNI.GraphicalObject_getBoundingBox(swigCPtr, this); 693 return (cPtr == 0) ? null : new BoundingBox(cPtr, false); 694 } 695 696 697/** */ public 698 boolean getBoundingBoxExplicitlySet() { 699 return libsbmlJNI.GraphicalObject_getBoundingBoxExplicitlySet(swigCPtr, this); 700 } 701 702 703/** 704 * Returns the XML element name of 705 * this SBML object. 706 <p> 707 * @return the string of the name of this element. 708 */ public 709 String getElementName() { 710 return libsbmlJNI.GraphicalObject_getElementName(swigCPtr, this); 711 } 712 713 714/** 715 * Creates and returns a deep copy of this {@link GraphicalObject}. 716 <p> 717 * @return a (deep) copy of this {@link GraphicalObject}. 718 */ public 719 GraphicalObject cloneObject() { 720 return (GraphicalObject) libsbml.DowncastSBase(libsbmlJNI.GraphicalObject_cloneObject(swigCPtr, this), true); 721} 722 723 724/** 725 * Returns the libSBML type code of this object instance. 726 <p> 727 * <p> 728 * LibSBML attaches an identifying code to every kind of SBML object. These 729 * are integer constants known as <em>SBML type codes</em>. The names of all 730 * the codes begin with the characters <code>SBML_</code>. 731 * In the Java language interface for libSBML, the 732 * type codes are defined as static integer constants in the interface class 733 * {@link libsbmlConstants}. Note that different Level 3 734 * package plug-ins may use overlapping type codes; to identify the package 735 * to which a given object belongs, call the <code>getPackageName()</code> 736 * method on the object. 737 <p> 738 * @return the SBML type code for this object: 739 * {@link libsbmlConstants#SBML_LAYOUT_GRAPHICALOBJECT SBML_LAYOUT_GRAPHICALOBJECT}. 740 <p> 741 * <p> 742 * @warning <span class='warning'>The specific integer values of the possible 743 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 744 * packages, To fully identify the correct code, <strong>it is necessary to 745 * invoke both getTypeCode() and getPackageName()</strong>.</span> 746 <p> 747 * @see #getElementName() 748 * @see #getPackageName() 749 */ public 750 int getTypeCode() { 751 return libsbmlJNI.GraphicalObject_getTypeCode(swigCPtr, this); 752 } 753 754 755/** 756 * Creates an {@link XMLNode} object from this. 757 */ public 758 XMLNode toXML() { 759 return new XMLNode(libsbmlJNI.GraphicalObject_toXML(swigCPtr, this), true); 760 } 761 762 public void connectToChild() { 763 libsbmlJNI.GraphicalObject_connectToChild(swigCPtr, this); 764 } 765 766 767/** * @internal */ public 768 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 769 libsbmlJNI.GraphicalObject_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 770 } 771 772}