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 011/** 012 * 013 * Class of object that encapsulates the properties of an SBML converter. 014 * <p> 015 * <p style='color: #777; font-style: italic'> 016This class of objects is defined by libSBML only and has no direct 017equivalent in terms of SBML components. It is a class used in 018the implementation of extra functionality provided by libSBML. 019</p> 020 021 * <p> 022 * The properties of SBML converters are communicated using objects of 023 * class {@link ConversionProperties}, and within such objects, individual options 024 * are encapsulated using {@link ConversionOption} objects. The {@link ConversionProperties} 025 * class provides numerous methods for setting and getting options. 026 * <p> 027 * {@link ConversionProperties} objects are also used to determine the target SBML 028 * namespace when an SBML converter's behavior depends on the intended 029 * Level+Version combination of SBML. In addition, it is conceivable that 030 * conversions may be affected by SBML Level 3 packages being used 031 * by an SBML document. These, too, are communicated by the values of 032 * the SBML namespaces set on a {@link ConversionProperties} object. 033 * <p> 034 * @see ConversionOption 035 * @see SBMLNamespaces 036 */ 037 038public class ConversionProperties { 039 private long swigCPtr; 040 protected boolean swigCMemOwn; 041 042 protected ConversionProperties(long cPtr, boolean cMemoryOwn) 043 { 044 swigCMemOwn = cMemoryOwn; 045 swigCPtr = cPtr; 046 } 047 048 protected static long getCPtr(ConversionProperties obj) 049 { 050 return (obj == null) ? 0 : obj.swigCPtr; 051 } 052 053 protected static long getCPtrAndDisown (ConversionProperties obj) 054 { 055 long ptr = 0; 056 057 if (obj != null) 058 { 059 ptr = obj.swigCPtr; 060 obj.swigCMemOwn = false; 061 } 062 063 return ptr; 064 } 065 066 protected void finalize() { 067 delete(); 068 } 069 070 public synchronized void delete() { 071 if (swigCPtr != 0) { 072 if (swigCMemOwn) { 073 swigCMemOwn = false; 074 libsbmlJNI.delete_ConversionProperties(swigCPtr); 075 } 076 swigCPtr = 0; 077 } 078 } 079 080 081/** 082 * Constructor that initializes the conversion properties 083 * with a specific SBML target namespace. 084 * <p> 085 * @param targetNS the target namespace to convert to 086 */ public 087 ConversionProperties(SBMLNamespaces targetNS) { 088 this(libsbmlJNI.new_ConversionProperties__SWIG_0(SBMLNamespaces.getCPtr(targetNS), targetNS), true); 089 } 090 091 092/** 093 * Constructor that initializes the conversion properties 094 * with a specific SBML target namespace. 095 * <p> 096 * @param targetNS the target namespace to convert to 097 */ public 098 ConversionProperties() { 099 this(libsbmlJNI.new_ConversionProperties__SWIG_1(), true); 100 } 101 102 103/** 104 * Copy constructor. 105 * <p> 106 * @param orig the object to copy. 107 * <p> 108 * @throws SBMLConstructorException 109 * Thrown if the argument <code>orig</code> is <code>null.</code> 110 */ public 111 ConversionProperties(ConversionProperties orig) { 112 this(libsbmlJNI.new_ConversionProperties__SWIG_2(ConversionProperties.getCPtr(orig), orig), true); 113 } 114 115 116/** 117 * Creates and returns a deep copy of this {@link ConversionProperties} object. 118 * <p> 119 * @return a (deep) copy of this {@link ConversionProperties} object. 120 */ public 121 ConversionProperties cloneObject() { 122 long cPtr = libsbmlJNI.ConversionProperties_cloneObject(swigCPtr, this); 123 return (cPtr == 0) ? null : new ConversionProperties(cPtr, true); 124 } 125 126 127/** 128 * Returns the current target SBML namespace. 129 * <p> 130 * @return the SBMLNamepaces object expressing the target namespace. 131 */ public 132 SBMLNamespaces getTargetNamespaces() { 133 return libsbml.DowncastSBMLNamespaces(libsbmlJNI.ConversionProperties_getTargetNamespaces(swigCPtr, this), false); 134} 135 136 137/** 138 * Returns <code>true</code> if the target SBML namespace has been set. 139 * <p> 140 * @return <code>true</code> if the target namespace has been set, <code>false</code> 141 * otherwise. 142 */ public 143 boolean hasTargetNamespaces() { 144 return libsbmlJNI.ConversionProperties_hasTargetNamespaces(swigCPtr, this); 145 } 146 147 148/** 149 * Sets the target namespace. 150 * <p> 151 * @param targetNS the target namespace to use. 152 */ public 153 void setTargetNamespaces(SBMLNamespaces targetNS) { 154 libsbmlJNI.ConversionProperties_setTargetNamespaces(swigCPtr, this, SBMLNamespaces.getCPtr(targetNS), targetNS); 155 } 156 157 158/** 159 * Returns the description string for a given option in this properties 160 * object. 161 * <p> 162 * @param key the key for the option. 163 * <p> 164 * @return the description text of the option with the given key. 165 */ public 166 String getDescription(String key) { 167 return libsbmlJNI.ConversionProperties_getDescription(swigCPtr, this, key); 168 } 169 170 171/** 172 * Returns the type of a given option in this properties object. 173 * <p> 174 * @param key the key for the option. 175 * <p> 176 * @return the type of the option with the given key. 177 */ public 178 int getType(String key) { 179 return libsbmlJNI.ConversionProperties_getType(swigCPtr, this, key); 180 } 181 182 183/** 184 * Returns the {@link ConversionOption} object for a given key. 185 * <p> 186 * @param key the key for the option. 187 * <p> 188 * @return the option with the given key. 189 */ public 190 ConversionOption getOption(String key) { 191 long cPtr = libsbmlJNI.ConversionProperties_getOption(swigCPtr, this, key); 192 return (cPtr == 0) ? null : new ConversionOption(cPtr, false); 193 } 194 195 196/** 197 * Adds a copy of the given option to this properties object. 198 * <p> 199 * @param option the option to add 200 */ public 201 void addOption(ConversionOption option) { 202 libsbmlJNI.ConversionProperties_addOption__SWIG_0(swigCPtr, this, ConversionOption.getCPtr(option), option); 203 } 204 205 206/** 207 * Adds a new {@link ConversionOption} object with the given parameters. 208 * <p> 209 * @param key the key for the new option 210 * @param value (optional) the value of that option 211 * @param type (optional) the type of the option 212 * @param description (optional) the description for the option 213 */ public 214 void addOption(String key, String value, int type, String description) { 215 libsbmlJNI.ConversionProperties_addOption__SWIG_1(swigCPtr, this, key, value, type, description); 216 } 217 218 219/** 220 * Adds a new {@link ConversionOption} object with the given parameters. 221 * <p> 222 * @param key the key for the new option 223 * @param value (optional) the value of that option 224 * @param type (optional) the type of the option 225 * @param description (optional) the description for the option 226 */ public 227 void addOption(String key, String value, int type) { 228 libsbmlJNI.ConversionProperties_addOption__SWIG_2(swigCPtr, this, key, value, type); 229 } 230 231 232/** 233 * Adds a new {@link ConversionOption} object with the given parameters. 234 * <p> 235 * @param key the key for the new option 236 * @param value (optional) the value of that option 237 * @param type (optional) the type of the option 238 * @param description (optional) the description for the option 239 */ public 240 void addOption(String key, String value) { 241 libsbmlJNI.ConversionProperties_addOption__SWIG_3(swigCPtr, this, key, value); 242 } 243 244 245/** 246 * Adds a new {@link ConversionOption} object with the given parameters. 247 * <p> 248 * @param key the key for the new option 249 * @param value (optional) the value of that option 250 * @param type (optional) the type of the option 251 * @param description (optional) the description for the option 252 */ public 253 void addOption(String key) { 254 libsbmlJNI.ConversionProperties_addOption__SWIG_4(swigCPtr, this, key); 255 } 256 257 258/** 259 * Adds a new {@link ConversionOption} object with the given parameters. 260 * <p> 261 * @param key the key for the new option 262 * @param value the string value of that option 263 * @param description (optional) the description for the option 264 */ public 265 void addOption(String key, String value, String description) { 266 libsbmlJNI.ConversionProperties_addOption__SWIG_5(swigCPtr, this, key, value, description); 267 } 268 269 270/** 271 * Adds a new {@link ConversionOption} object with the given parameters. 272 * <p> 273 * @param key the key for the new option 274 * @param value the boolean value of that option 275 * @param description (optional) the description for the option 276 */ public 277 void addOption(String key, boolean value, String description) { 278 libsbmlJNI.ConversionProperties_addOption__SWIG_7(swigCPtr, this, key, value, description); 279 } 280 281 282/** 283 * Adds a new {@link ConversionOption} object with the given parameters. 284 * <p> 285 * @param key the key for the new option 286 * @param value the boolean value of that option 287 * @param description (optional) the description for the option 288 */ public 289 void addOption(String key, boolean value) { 290 libsbmlJNI.ConversionProperties_addOption__SWIG_8(swigCPtr, this, key, value); 291 } 292 293 294/** 295 * Adds a new {@link ConversionOption} object with the given parameters. 296 * <p> 297 * @param key the key for the new option 298 * @param value the double value of that option 299 * @param description (optional) the description for the option 300 */ public 301 void addOption(String key, double value, String description) { 302 libsbmlJNI.ConversionProperties_addOption__SWIG_9(swigCPtr, this, key, value, description); 303 } 304 305 306/** 307 * Adds a new {@link ConversionOption} object with the given parameters. 308 * <p> 309 * @param key the key for the new option 310 * @param value the double value of that option 311 * @param description (optional) the description for the option 312 */ public 313 void addOption(String key, double value) { 314 libsbmlJNI.ConversionProperties_addOption__SWIG_10(swigCPtr, this, key, value); 315 } 316 317 318/** 319 * Adds a new {@link ConversionOption} object with the given parameters. 320 * <p> 321 * @param key the key for the new option 322 * @param value the float value of that option 323 * @param description (optional) the description for the option 324 */ public 325 void addOption(String key, float value, String description) { 326 libsbmlJNI.ConversionProperties_addOption__SWIG_11(swigCPtr, this, key, value, description); 327 } 328 329 330/** 331 * Adds a new {@link ConversionOption} object with the given parameters. 332 * <p> 333 * @param key the key for the new option 334 * @param value the float value of that option 335 * @param description (optional) the description for the option 336 */ public 337 void addOption(String key, float value) { 338 libsbmlJNI.ConversionProperties_addOption__SWIG_12(swigCPtr, this, key, value); 339 } 340 341 342/** 343 * Adds a new {@link ConversionOption} object with the given parameters. 344 * <p> 345 * @param key the key for the new option 346 * @param value the integer value of that option 347 * @param description (optional) the description for the option 348 */ public 349 void addOption(String key, int value, String description) { 350 libsbmlJNI.ConversionProperties_addOption__SWIG_13(swigCPtr, this, key, value, description); 351 } 352 353 354/** 355 * Adds a new {@link ConversionOption} object with the given parameters. 356 * <p> 357 * @param key the key for the new option 358 * @param value the integer value of that option 359 * @param description (optional) the description for the option 360 */ public 361 void addOption(String key, int value) { 362 libsbmlJNI.ConversionProperties_addOption__SWIG_14(swigCPtr, this, key, value); 363 } 364 365 366/** 367 * Removes the option with the given key from this properties object. 368 * <p> 369 * @param key the key for the new option to remove 370 * @return the removed option 371 */ public 372 ConversionOption removeOption(String key) { 373 long cPtr = libsbmlJNI.ConversionProperties_removeOption(swigCPtr, this, key); 374 return (cPtr == 0) ? null : new ConversionOption(cPtr, false); 375 } 376 377 378/** 379 * Returns <code>true</code> if this properties object contains an option with 380 * the given key. 381 * <p> 382 * @param key the key of the option to find. 383 * <p> 384 * @return <code>true</code> if an option with the given <code>key</code> exists in 385 * this properties object, <code>false</code> otherwise. 386 */ public 387 boolean hasOption(String key) { 388 return libsbmlJNI.ConversionProperties_hasOption(swigCPtr, this, key); 389 } 390 391 392/** 393 * Returns the value of the given option as a string. 394 * <p> 395 * @param key the key for the option. 396 * <p> 397 * @return the string value of the option with the given key. 398 */ public 399 String getValue(String key) { 400 return libsbmlJNI.ConversionProperties_getValue(swigCPtr, this, key); 401 } 402 403 404/** 405 * Sets the value of the given option to a string. 406 * <p> 407 * @param key the key for the option 408 * @param value the new value 409 */ public 410 void setValue(String key, String value) { 411 libsbmlJNI.ConversionProperties_setValue(swigCPtr, this, key, value); 412 } 413 414 415/** 416 * Returns the value of the given option as a Boolean. 417 * <p> 418 * @param key the key for the option. 419 * <p> 420 * @return the boolean value of the option with the given key. 421 */ public 422 boolean getBoolValue(String key) { 423 return libsbmlJNI.ConversionProperties_getBoolValue(swigCPtr, this, key); 424 } 425 426 427/** 428 * Sets the value of the given option to a Boolean. 429 * <p> 430 * @param key the key for the option. 431 * <p> 432 * @param value the new Boolean value. 433 */ public 434 void setBoolValue(String key, boolean value) { 435 libsbmlJNI.ConversionProperties_setBoolValue(swigCPtr, this, key, value); 436 } 437 438 439/** 440 * Returns the value of the given option as a <code>double.</code> 441 * <p> 442 * @param key the key for the option. 443 * <p> 444 * @return the double value of the option with the given key. 445 */ public 446 double getDoubleValue(String key) { 447 return libsbmlJNI.ConversionProperties_getDoubleValue(swigCPtr, this, key); 448 } 449 450 451/** 452 * Sets the value of the given option to a <code>double.</code> 453 * <p> 454 * @param key the key for the option. 455 * <p> 456 * @param value the new double value. 457 */ public 458 void setDoubleValue(String key, double value) { 459 libsbmlJNI.ConversionProperties_setDoubleValue(swigCPtr, this, key, value); 460 } 461 462 463/** 464 * Returns the value of the given option as a <code>float.</code> 465 * <p> 466 * @param key the key for the option. 467 * <p> 468 * @return the float value of the option with the given key. 469 */ public 470 float getFloatValue(String key) { 471 return libsbmlJNI.ConversionProperties_getFloatValue(swigCPtr, this, key); 472 } 473 474 475/** 476 * Sets the value of the given option to a <code>float.</code> 477 * <p> 478 * @param key the key for the option. 479 * <p> 480 * @param value the new float value. 481 */ public 482 void setFloatValue(String key, float value) { 483 libsbmlJNI.ConversionProperties_setFloatValue(swigCPtr, this, key, value); 484 } 485 486 487/** 488 * Returns the value of the given option as an integer. 489 * <p> 490 * @param key the key for the option. 491 * <p> 492 * @return the int value of the option with the given key. 493 */ public 494 int getIntValue(String key) { 495 return libsbmlJNI.ConversionProperties_getIntValue(swigCPtr, this, key); 496 } 497 498 499/** 500 * Sets the value of the given option to an integer. 501 * <p> 502 * @param key the key for the option. 503 * <p> 504 * @param value the new integer value. 505 */ public 506 void setIntValue(String key, int value) { 507 libsbmlJNI.ConversionProperties_setIntValue(swigCPtr, this, key, value); 508 } 509 510}