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 a conversion option. 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 * LibSBML provides a number of converters that can perform transformations 023 * on SBML documents. These converters allow their behaviors to be 024 * controlled by setting property values. Converter properties are 025 * communicated using objects of class {@link ConversionProperties}, and within 026 * such objects, individual options are encapsulated using {@link ConversionOption} 027 * objects. 028 * <p> 029 * A {@link ConversionOption} object consists of four parts: 030 * <ul> 031 * <li> A <em>key</em>, acting as the name of the option; 032 * <li> A <em>value</em> of this option; 033 * <li> A <em>type</em> for the value; this is chosen from the enumeration type 034 * <a class='el' href='#ConversionOptionType_t'>ConversionOptionType_t</a>; and 035 * <li> A <em>description</em> consisting of a text string that describes the 036 * option in some way. 037 * </ul> 038 * <p> 039 * There are no constraints on the values of keys or descriptions; 040 * authors of SBML converters are free to choose them as they see fit. 041 * <p> 042 * <h2>Conversion option data types</h2> 043 * <p> 044 * An option in {@link ConversionOption} must have a data type declared, to 045 * indicate whether it is a string value, an integer, and so forth. The 046 * possible types of values are taken from the enumeration <a 047 * class='el' href='#ConversionOptionType_t'>ConversionOptionType_t</a>. 048 * The following are the possible values: 049 * <p> 050 * <p> 051 * <center> 052 * <table width='90%' cellspacing='1' cellpadding='1' border='0' class='normal-font'> 053 * <tr style='background: lightgray' class='normal-font'> 054 * <td><strong>Enumerator</strong></td> 055 * <td><strong>Meaning</strong></td> 056 * </tr> 057 * <tr> 058 * <td><code>{@link libsbmlConstants#CNV_TYPE_BOOL CNV_TYPE_BOOL}</code></td> 059 * <td>Indicates the value type is a Boolean.</td> 060 * </tr> 061 * <tr> 062 * <td><code>{@link libsbmlConstants#CNV_TYPE_DOUBLE CNV_TYPE_DOUBLE}</code></td> 063 * <td>Indicates the value type is a double-sized float.</td> 064 * </tr> 065 * <tr> 066 * <td><code>{@link libsbmlConstants#CNV_TYPE_INT CNV_TYPE_INT}</code></td> 067 * <td>Indicates the value type is an integer.</td> 068 * </tr> 069 * <tr> 070 * <td><code>{@link libsbmlConstants#CNV_TYPE_SINGLE CNV_TYPE_SINGLE}</code></td> 071 * <td>Indicates the value type is a float.</td> 072 * </tr> 073 * <tr> 074 * <td><code>{@link libsbmlConstants#CNV_TYPE_STRING CNV_TYPE_STRING}</code></td> 075 * <td>Indicates the value type is a string.</td> 076 * </tr> 077 * </table> 078 * </center> 079 * <p> 080 * @see ConversionProperties 081 */ 082 083public class ConversionOption { 084 private long swigCPtr; 085 protected boolean swigCMemOwn; 086 087 protected ConversionOption(long cPtr, boolean cMemoryOwn) 088 { 089 swigCMemOwn = cMemoryOwn; 090 swigCPtr = cPtr; 091 } 092 093 protected static long getCPtr(ConversionOption obj) 094 { 095 return (obj == null) ? 0 : obj.swigCPtr; 096 } 097 098 protected static long getCPtrAndDisown (ConversionOption obj) 099 { 100 long ptr = 0; 101 102 if (obj != null) 103 { 104 ptr = obj.swigCPtr; 105 obj.swigCMemOwn = false; 106 } 107 108 return ptr; 109 } 110 111 protected void finalize() { 112 delete(); 113 } 114 115 public synchronized void delete() { 116 if (swigCPtr != 0) { 117 if (swigCMemOwn) { 118 swigCMemOwn = false; 119 libsbmlJNI.delete_ConversionOption(swigCPtr); 120 } 121 swigCPtr = 0; 122 } 123 } 124 125 126/** 127 * Creates a new {@link ConversionOption}. 128 * <p> 129 * This is the general constructor, taking arguments for all aspects of 130 * an option. Other constructors exist with different arguments. 131 * <p> 132 * @param key the key for this option 133 * @param value an optional value for this option 134 * @param type the type of this option 135 * @param description the description for this option 136 */ public 137 ConversionOption(String key, String value, int type, String description) { 138 this(libsbmlJNI.new_ConversionOption__SWIG_0(key, value, type, description), true); 139 } 140 141 142/** 143 * Creates a new {@link ConversionOption}. 144 * <p> 145 * This is the general constructor, taking arguments for all aspects of 146 * an option. Other constructors exist with different arguments. 147 * <p> 148 * @param key the key for this option 149 * @param value an optional value for this option 150 * @param type the type of this option 151 * @param description the description for this option 152 */ public 153 ConversionOption(String key, String value, int type) { 154 this(libsbmlJNI.new_ConversionOption__SWIG_1(key, value, type), true); 155 } 156 157 158/** 159 * Creates a new {@link ConversionOption}. 160 * <p> 161 * This is the general constructor, taking arguments for all aspects of 162 * an option. Other constructors exist with different arguments. 163 * <p> 164 * @param key the key for this option 165 * @param value an optional value for this option 166 * @param type the type of this option 167 * @param description the description for this option 168 */ public 169 ConversionOption(String key, String value) { 170 this(libsbmlJNI.new_ConversionOption__SWIG_2(key, value), true); 171 } 172 173 174/** 175 * Creates a new {@link ConversionOption}. 176 * <p> 177 * This is the general constructor, taking arguments for all aspects of 178 * an option. Other constructors exist with different arguments. 179 * <p> 180 * @param key the key for this option 181 * @param value an optional value for this option 182 * @param type the type of this option 183 * @param description the description for this option 184 */ public 185 ConversionOption(String key) { 186 this(libsbmlJNI.new_ConversionOption__SWIG_3(key), true); 187 } 188 189 190/** 191 * Creates a new {@link ConversionOption} specialized for string-type options. 192 * <p> 193 * @param key the key for this option 194 * @param value the value for this option 195 * @param description an optional description 196 */ public 197 ConversionOption(String key, String value, String description) { 198 this(libsbmlJNI.new_ConversionOption__SWIG_4(key, value, description), true); 199 } 200 201 202/** 203 * Creates a new {@link ConversionOption} specialized for Boolean-type options. 204 * <p> 205 * @param key the key for this option 206 * @param value the value for this option 207 * @param description an optional description 208 */ public 209 ConversionOption(String key, boolean value, String description) { 210 this(libsbmlJNI.new_ConversionOption__SWIG_6(key, value, description), true); 211 } 212 213 214/** 215 * Creates a new {@link ConversionOption} specialized for Boolean-type options. 216 * <p> 217 * @param key the key for this option 218 * @param value the value for this option 219 * @param description an optional description 220 */ public 221 ConversionOption(String key, boolean value) { 222 this(libsbmlJNI.new_ConversionOption__SWIG_7(key, value), true); 223 } 224 225 226/** 227 * Creates a new {@link ConversionOption} specialized for double-type options. 228 * <p> 229 * @param key the key for this option 230 * @param value the value for this option 231 * @param description an optional description 232 */ public 233 ConversionOption(String key, double value, String description) { 234 this(libsbmlJNI.new_ConversionOption__SWIG_8(key, value, description), true); 235 } 236 237 238/** 239 * Creates a new {@link ConversionOption} specialized for double-type options. 240 * <p> 241 * @param key the key for this option 242 * @param value the value for this option 243 * @param description an optional description 244 */ public 245 ConversionOption(String key, double value) { 246 this(libsbmlJNI.new_ConversionOption__SWIG_9(key, value), true); 247 } 248 249 250/** 251 * Creates a new {@link ConversionOption} specialized for float-type options. 252 * <p> 253 * @param key the key for this option 254 * @param value the value for this option 255 * @param description an optional description 256 */ public 257 ConversionOption(String key, float value, String description) { 258 this(libsbmlJNI.new_ConversionOption__SWIG_10(key, value, description), true); 259 } 260 261 262/** 263 * Creates a new {@link ConversionOption} specialized for float-type options. 264 * <p> 265 * @param key the key for this option 266 * @param value the value for this option 267 * @param description an optional description 268 */ public 269 ConversionOption(String key, float value) { 270 this(libsbmlJNI.new_ConversionOption__SWIG_11(key, value), true); 271 } 272 273 274/** 275 * Creates a new {@link ConversionOption} specialized for integer-type options. 276 * <p> 277 * @param key the key for this option 278 * @param value the value for this option 279 * @param description an optional description 280 */ public 281 ConversionOption(String key, int value, String description) { 282 this(libsbmlJNI.new_ConversionOption__SWIG_12(key, value, description), true); 283 } 284 285 286/** 287 * Creates a new {@link ConversionOption} specialized for integer-type options. 288 * <p> 289 * @param key the key for this option 290 * @param value the value for this option 291 * @param description an optional description 292 */ public 293 ConversionOption(String key, int value) { 294 this(libsbmlJNI.new_ConversionOption__SWIG_13(key, value), true); 295 } 296 297 298/** 299 * Copy constructor; creates a copy of an {@link ConversionOption} object. 300 * <p> 301 * @param orig the {@link ConversionOption} object to copy. 302 * <p> 303 * @throws SBMLConstructorException 304 * Thrown if the argument <code>orig</code> is <code>null.</code> 305 */ public 306 ConversionOption(ConversionOption orig) { 307 this(libsbmlJNI.new_ConversionOption__SWIG_14(ConversionOption.getCPtr(orig), orig), true); 308 } 309 310 311/** 312 * Creates and returns a deep copy of this {@link ConversionOption} object. 313 * <p> 314 * @return a (deep) copy of this {@link ConversionOption} object. 315 */ public 316 ConversionOption cloneObject() { 317 long cPtr = libsbmlJNI.ConversionOption_cloneObject(swigCPtr, this); 318 return (cPtr == 0) ? null : new ConversionOption(cPtr, true); 319 } 320 321 322/** 323 * Returns the key for this option. 324 * <p> 325 * @return the key, as a string. 326 */ public 327 String getKey() { 328 return libsbmlJNI.ConversionOption_getKey(swigCPtr, this); 329 } 330 331 332/** 333 * Sets the key for this option. 334 * <p> 335 * @param key a string representing the key to set. 336 */ public 337 void setKey(String key) { 338 libsbmlJNI.ConversionOption_setKey(swigCPtr, this, key); 339 } 340 341 342/** 343 * Returns the value of this option. 344 * <p> 345 * @return the value of this option, as a string. 346 */ public 347 String getValue() { 348 return libsbmlJNI.ConversionOption_getValue(swigCPtr, this); 349 } 350 351 352/** 353 * Sets the value for this option. 354 * <p> 355 * @param value the value to set, as a string. 356 */ public 357 void setValue(String value) { 358 libsbmlJNI.ConversionOption_setValue(swigCPtr, this, value); 359 } 360 361 362/** 363 * Returns the description string for this option. 364 * <p> 365 * @return the description of this option. 366 */ public 367 String getDescription() { 368 return libsbmlJNI.ConversionOption_getDescription(swigCPtr, this); 369 } 370 371 372/** 373 * Sets the description text for this option. 374 * <p> 375 * @param description the description to set for this option. 376 */ public 377 void setDescription(String description) { 378 libsbmlJNI.ConversionOption_setDescription(swigCPtr, this, description); 379 } 380 381 382/** 383 * Returns the type of this option 384 * <p> 385 * @return the type of this option. 386 */ public 387 int getType() { 388 return libsbmlJNI.ConversionOption_getType(swigCPtr, this); 389 } 390 391 392/** 393 * Sets the type of this option. 394 * <p> 395 * @param type the type value to use. 396 */ public 397 void setType(int type) { 398 libsbmlJNI.ConversionOption_setType(swigCPtr, this, type); 399 } 400 401 402/** 403 * Returns the value of this option as a Boolean. 404 * <p> 405 * @return the value of this option. 406 */ public 407 boolean getBoolValue() { 408 return libsbmlJNI.ConversionOption_getBoolValue(swigCPtr, this); 409 } 410 411 412/** 413 * Set the value of this option to a given Boolean value. 414 * <p> 415 * Invoking this method will also set the type of the option to 416 * {@link libsbmlConstants#CNV_TYPE_BOOL CNV_TYPE_BOOL}. 417 * <p> 418 * @param value the Boolean value to set 419 */ public 420 void setBoolValue(boolean value) { 421 libsbmlJNI.ConversionOption_setBoolValue(swigCPtr, this, value); 422 } 423 424 425/** 426 * Returns the value of this option as a <code>double.</code> 427 * <p> 428 * @return the value of this option. 429 */ public 430 double getDoubleValue() { 431 return libsbmlJNI.ConversionOption_getDoubleValue(swigCPtr, this); 432 } 433 434 435/** 436 * Set the value of this option to a given <code>double</code> value. 437 * <p> 438 * Invoking this method will also set the type of the option to 439 * {@link libsbmlConstants#CNV_TYPE_DOUBLE CNV_TYPE_DOUBLE}. 440 * <p> 441 * @param value the value to set 442 */ public 443 void setDoubleValue(double value) { 444 libsbmlJNI.ConversionOption_setDoubleValue(swigCPtr, this, value); 445 } 446 447 448/** 449 * Returns the value of this option as a <code>float.</code> 450 * <p> 451 * @return the value of this option as a float 452 */ public 453 float getFloatValue() { 454 return libsbmlJNI.ConversionOption_getFloatValue(swigCPtr, this); 455 } 456 457 458/** 459 * Set the value of this option to a given <code>float</code> value. 460 * <p> 461 * Invoking this method will also set the type of the option to 462 * {@link libsbmlConstants#CNV_TYPE_SINGLE CNV_TYPE_SINGLE}. 463 * <p> 464 * @param value the value to set 465 */ public 466 void setFloatValue(float value) { 467 libsbmlJNI.ConversionOption_setFloatValue(swigCPtr, this, value); 468 } 469 470 471/** 472 * Returns the value of this option as an <code>integer.</code> 473 * <p> 474 * @return the value of this option, as an int 475 */ public 476 int getIntValue() { 477 return libsbmlJNI.ConversionOption_getIntValue(swigCPtr, this); 478 } 479 480 481/** 482 * Set the value of this option to a given <code>int</code> value. 483 * <p> 484 * Invoking this method will also set the type of the option to 485 * {@link libsbmlConstants#CNV_TYPE_INT CNV_TYPE_INT}. 486 * <p> 487 * @param value the value to set 488 */ public 489 void setIntValue(int value) { 490 libsbmlJNI.ConversionOption_setIntValue(swigCPtr, this, value); 491 } 492 493}