source: branches/r9/lang/java/Units.java @ 4852

Last change on this file since 4852 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

File size: 1.3 KB
Line 
1/*
2 * ======================================================================
3 *  AUTHOR:  Ben Rafferty, Purdue University
4 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
5 *
6 *  See the file "license.terms" for information on usage and
7 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8 * ======================================================================
9 */
10
11/*
12 * This file defines a java class that implemements the rappture units module.
13 * The class methods call the corresponding native code through c++ glue code
14 * located in jRpUnits.cc.
15 */
16
17
18package rappture;
19
20public class Units{
21  static {
22    System.loadLibrary("JRappture");
23  }
24
25  // Public Methods------------------------------------------------------------
26  public static double convertDouble(double fromVal, String to){
27    return Double.parseDouble(
28      jRpUnitsConvert(Double.toString(fromVal), to, false));
29  }
30
31  public static String convertString(String fromVal, String to, boolean units){
32    return jRpUnitsConvert(fromVal, to, units);
33  }
34
35  public static String convertString(String fromVal, String to){
36    return jRpUnitsConvert(fromVal, to, true);
37  }
38
39  // Native Functions----------------------------------------------------------
40  private static native String jRpUnitsConvert(String fromVal, String to,
41    boolean units);
42}
43
44
45
Note: See TracBrowser for help on using the repository browser.