354 | | public void '''putDouble(''' String ''path'', double ''value'' ''')''' |
355 | | |
356 | | Purpose: |
357 | | |
358 | | Places ''value'' into the library at the xml location ''path''. If the ''append'' flag is set to 1, then ''value'' will be appended to data that already exists at ''path''. If the ''append'' flag is set to false, then ''value'' will overwrite data that may have existed at ''path''. |
359 | | |
360 | | Input Arguments: |
361 | | |
362 | | 1) ''path'' - xml path (location) to store ''value''. |
363 | | |
364 | | 2) ''value'' - Data to store in the library object. |
365 | | |
366 | | 3) ''append'' - Append flag. If set to false, data at ''path'' will be overwritten. If set to true, new data will be appended to the existing data. |
| 340 | public void '''putFile(''' String ''path'', String ''filename'', boolean ''compress'', boolean ''append'' ''')''' |
| 341 | |
| 342 | Purpose: |
| 343 | |
| 344 | Places the contents of the file ''filename'' into the library at the xml location ''path''. If the ''append'' flag is set to 1, then ''value'' will be appended to data that already exists at ''path''. If the ''append'' flag is set to false, then ''value'' will overwrite data that may have existed at ''path''. |
| 345 | |
| 346 | Input Arguments: |
| 347 | |
| 348 | 1) ''path'' - xml path (location) to store ''value''. |
| 349 | |
| 350 | 2) ''filename'' - Name of the file to be stored. |
| 351 | |
| 352 | 3) ''compress'' - Set to true to indicate that the binary data should be compressed. |
| 353 | |
| 354 | 4) ''append'' - Append flag. If set to false, data at ''path'' will be overwritten. If set to true, new data will be appended to the existing data. |
| 355 | |
| 356 | public void '''putFile(''' String ''path'', String ''filename'', boolean ''compress'' ''')''' |
| 357 | |
| 358 | Purpose: |
| 359 | |
| 360 | Places the contents of the file ''filename'' into the library at the xml location ''path''. Overwrites any data that previously existed at path. Equivalent to putFile(''path'', ''value'', ''compress'', false). |
| 361 | |
| 362 | Input Arguments: |
| 363 | |
| 364 | 1) ''path'' - xml path (location) to store ''value''. |
| 365 | |
| 366 | 2) ''filename'' - Name of the file to be stored. |
| 367 | |
| 368 | 3) ''compress'' - Set to true to indicate that the binary data should be compressed. |
| 369 | |
| 370 | public void '''putFile(''' String ''path'', String ''filename'' ''')''' |
| 371 | |
| 372 | Purpose: |
| 373 | |
| 374 | Places the contents of the file ''filename'' into the library at the xml location ''path''. Binary data is automatically compressed. Overwrites any data that previously existed at path. Equivalent to putFile(''path'', ''value'', true, false). |
| 375 | |
| 376 | Input Arguments: |
| 377 | |
| 378 | 1) ''path'' - xml path (location) to store ''value''. |
| 379 | |
| 380 | 2) ''filename'' - Name of the file to be stored. |
| 381 | |
| 382 | public void '''result(''' int ''exitStatus'' ''')''' |
| 383 | |
| 384 | Purpose: |
| 385 | |
| 386 | Write the data from Library object instance to file and signal the end of processing to the graphical user interface. |
| 387 | |
| 388 | Input Arguments: |
| 389 | |
| 390 | 1) ''exitStatus'' - Integer representing the success or failure of the application. 0 for success, any other number is failure. |
395 | | # Ef = 12.345 |
396 | | }}} |
397 | | |
398 | | public void '''putFile(''' String ''path'', String ''filename'', boolean ''compress'', boolean ''append'' ''')''' |
399 | | |
400 | | Purpose: |
401 | | |
402 | | Places the contents of the file ''filename'' into the library at the xml location ''path''. If the ''append'' flag is set to 1, then ''value'' will be appended to data that already exists at ''path''. If the ''append'' flag is set to false, then ''value'' will overwrite data that may have existed at ''path''. |
403 | | |
404 | | Input Arguments: |
405 | | |
406 | | 1) ''path'' - xml path (location) to store ''value''. |
407 | | |
408 | | 2) ''filename'' - Name of the file to be stored. |
409 | | |
410 | | 3) ''compress'' - Set to true to indicate that the binary data should be compressed. |
411 | | |
412 | | 4) ''append'' - Append flag. If set to false, data at ''path'' will be overwritten. If set to true, new data will be appended to the existing data. |
413 | | |
414 | | public void '''putFile(''' String ''path'', String ''filename'', boolean ''compress'' ''')''' |
415 | | |
416 | | Purpose: |
417 | | |
418 | | Places the contents of the file ''filename'' into the library at the xml location ''path''. Overwrites any data that previously existed at path. Equivalent to putFile(''path'', ''value'', ''compress'', false). |
419 | | |
420 | | Input Arguments: |
421 | | |
422 | | 1) ''path'' - xml path (location) to store ''value''. |
423 | | |
424 | | 2) ''filename'' - Name of the file to be stored. |
425 | | |
426 | | 3) ''compress'' - Set to true to indicate that the binary data should be compressed. |
427 | | |
428 | | public void '''putFile(''' String ''path'', String ''filename'' ''')''' |
429 | | |
430 | | Purpose: |
431 | | |
432 | | Places the contents of the file ''filename'' into the library at the xml location ''path''. Binary data is automatically compressed. Overwrites any data that previously existed at path. Equivalent to putFile(''path'', ''value'', true, false). |
433 | | |
434 | | Input Arguments: |
435 | | |
436 | | 1) ''path'' - xml path (location) to store ''value''. |
437 | | |
438 | | 2) ''filename'' - Name of the file to be stored. |
439 | | |
440 | | public void '''putString(''' String ''path'', String ''value'', boolean ''append'' ''')''' |
441 | | |
442 | | Purpose: |
443 | | |
444 | | Place the string ''value'' into the library at the xml location ''path''. If the ''append'' flag is set to 1, then ''value'' will be appended to data that already exists at ''path''. If the ''append'' flag is set to false, then ''value'' will overwrite data that may have existed at ''path''. Similar to put(''path'', ''value'', ''append''), except only Strings are accepted for ''value''. |
445 | | |
446 | | Input Arguments: |
447 | | |
448 | | 1) ''path'' - xml path (location) to store ''value''. |
449 | | |
450 | | 2) ''value'' - Data to store in the library. |
451 | | |
452 | | 3) ''append'' - Append flag. If set to false, data at ''path'' will be overwritten. If set to true, new data will be appended to the existing data. |
453 | | |
454 | | public void '''putString(''' String ''path'', String ''value'' ''')''' |
455 | | |
456 | | Purpose: |
457 | | |
458 | | Place the string ''value'' into the library at the xml location path. Overwrites any data that previously existed at path. Equivalent to putString(''path'', ''value'', ''false''). |
459 | | |
460 | | Input Arguments: |
461 | | |
462 | | 1) ''path'' - xml path (location) to store ''value''. |
463 | | |
464 | | 2) ''value'' - Data to store in the library. |
465 | | |
466 | | |
467 | | public void '''result(''' int ''exitStatus'' ''')''' |
468 | | |
469 | | Purpose: |
470 | | |
471 | | Write the data from Library object instance to file and signal the end of processing to the graphical user interface. |
472 | | |
473 | | Input Arguments: |
474 | | |
475 | | 1) ''exitStatus'' - Integer representing the success or failure of the application. 0 for success, any other number is failure. |
| 420 | # A run.xml file is created and the Rappture graphical user Interface is signaled that processing has ended. |
| 421 | }}} |
| 422 | |
| 423 | public void '''result()''' |
| 424 | |
| 425 | Purpose: |
| 426 | |
| 427 | Write the data from Library object instance to file and signal the end of processing to the graphical user interface. Equivalent to result(0). |
| 428 | |
| 429 | public String '''xml()''' |
| 430 | |
| 431 | Purpose: |
| 432 | |
| 433 | Provides the entire xml of the Library. |
| 434 | |
| 435 | Return Value: |
| 436 | |
| 437 | Returns a String object containing the entire xml of the Library. |
| 438 | |
| 439 | |
| 440 | == Units Class Detail == |
| 441 | |
| 442 | __'''Method Detail'''__ |
| 443 | |
| 444 | public double '''convertDouble(''' String ''fromVal'', String ''to'' ''')''' |
| 445 | |
| 446 | Purpose: |
| 447 | |
| 448 | Returns the decimal value of the String ''fromVal'' in units given by the String ''to''. Equivalent to Double.valueOf(convertString(fromVal, to, false)). |
| 449 | |
| 450 | Input Arguments: |
| 451 | |
| 452 | 1) ''fromVal'' - String with numeric portion as well as optional units (for example: "3m" or "3"). |
| 453 | |
| 454 | 2) ''to'' - String name of the units to convert to. |
| 455 | |
| 456 | Return Value: |
| 457 | |
| 458 | Decimal value of ''fromVal'' in units specified by ''to''. |
| 459 | |
| 460 | public String '''convertString(''' String ''fromVal'', String ''to'', boolean ''units'' ''')''' |
| 461 | |
| 462 | Purpose: |
| 463 | |
| 464 | Returns a String containing the value of the String ''fromVal'' in units given by the String ''to''. Units are appended to the result if the ''units'' flag is true. |
| 465 | |
| 466 | Input Arguments: |
| 467 | |
| 468 | 1) ''fromVal'' - String with the numeric portion as well as optional units (for example: "3m" or "3"). |
| 469 | |
| 470 | 2) ''to'' - String name of the units to convert to. |
| 471 | |
| 472 | 3) ''units'' - Flag to indicate whether or not units should be included in the output String. |
| 473 | |
| 474 | Return Value: |
| 475 | |
| 476 | String containing the converted value of ''fromVal'' in units specified by ''to'' with optional units. |
493 | | String Ef; |
494 | | rappture.Library driver = new rappture.Library("driver.xml"); |
495 | | driver.put("input.number(Ef).current", "6eV"); |
496 | | Ef = driver.get("input.number(Ef).current"); |
497 | | System.out.println("Ef = " + Ef); |
498 | | driver.result(0); |
499 | | System.exit(0); |
500 | | } |
501 | | } |
502 | | |
503 | | # Result: |
504 | | # |
505 | | # A run.xml file is created and the Rappture graphical user Interface is signaled that processing has ended. |
506 | | }}} |
507 | | |
508 | | public void '''result()''' |
509 | | |
510 | | Purpose: |
511 | | |
512 | | Write the data from Library object instance to file and signal the end of processing to the graphical user interface. Equivalent to result(0). |
513 | | |
514 | | public String '''xml()''' |
515 | | |
516 | | Purpose: |
517 | | |
518 | | Provides the entire xml of the Library. |
519 | | |
520 | | Return Value: |
521 | | |
522 | | Returns a String object containing the entire xml of the Library. |
523 | | |
524 | | |
525 | | == Units Class Detail == |
526 | | |
527 | | __'''Method Detail'''__ |
528 | | |
529 | | public double '''convertDouble(''' String ''fromVal'', String ''to'' ''')''' |
530 | | |
531 | | Purpose: |
532 | | |
533 | | Returns the decimal value of the String ''fromVal'' in units given by the String ''to''. Equivalent to Double.valueOf(convertString(fromVal, to, false)). |
534 | | |
535 | | Input Arguments: |
536 | | |
537 | | 1) ''fromVal'' - String with numeric portion as well as optional units (for example: "3m" or "3"). |
538 | | |
539 | | 2) ''to'' - String name of the units to convert to. |
540 | | |
541 | | Return Value: |
542 | | |
543 | | Decimal value of ''fromVal'' in units specified by ''to''. |
544 | | |
545 | | public String '''convertString(''' String ''fromVal'', String ''to'', boolean ''units'' ''')''' |
546 | | |
547 | | Purpose: |
548 | | |
549 | | Returns a String containing the value of the String ''fromVal'' in units given by the String ''to''. Units are appended to the result if the ''units'' flag is true. |
550 | | |
551 | | Input Arguments: |
552 | | |
553 | | 1) ''fromVal'' - String with the numeric portion as well as optional units (for example: "3m" or "3"). |
554 | | |
555 | | 2) ''to'' - String name of the units to convert to. |
556 | | |
557 | | 3) ''units'' - Flag to indicate whether or not units should be included in the output String. |
558 | | |
559 | | Return Value: |
560 | | |
561 | | String containing the converted value of ''fromVal'' in units specified by ''to'' with optional units. |
562 | | |
563 | | {{{ |
564 | | # Contents of driver.xml |
565 | | # <run> |
566 | | # <input> |
567 | | # <number id="Ef"> |
568 | | # <units>eV</units> |
569 | | # <min>-10eV</min> |
570 | | # <max>10eV</max> |
571 | | # <default>0eV</default> |
572 | | # <current>3eV</current> |
573 | | # </number> |
574 | | # </input> |
575 | | # </run> |
576 | | |
577 | | class Example{ |
578 | | public static void main(String args[]){ |