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