jhplot
Class UCalc
- java.lang.Object
-
- jhplot.UCalc
-
public class UCalc extends java.lang.Object
Calculations using different measurement and physics unit systems.
-
-
Constructor Summary
Constructors Constructor and Description UCalc()
Initialaze calculations with units.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.String
eval(java.lang.String havestr, java.lang.String wantstr)
Performs the computation with units.java.lang.String
getUnit()
Returns expected unit.double
getValue()
Returns answer as double.void
help()
Show help topics in a window.void
search()
Shows units and functions with names containing the current unit.void
search(java.lang.String name)
Shows units and functions with names containing a given substring.void
showConformable()
Shows units, functions, and aliases conformable to given Value.java.lang.String
showDef(java.lang.String name)
If the argument is the name of a function or unit list, returns its definition.void
showSource()
Show source.
-
-
-
Method Detail
-
eval
public java.lang.String eval(java.lang.String havestr, java.lang.String wantstr)
Performs the computation with units.- Parameters:
havestr
- expression specifying the value to be converted.toString
- string specifying unit of the desired result: expression, function name, unit list name, or unit list.- Returns:
- answer as a string. If "error", then there was an error
-
getValue
public double getValue()
Returns answer as double.- Returns:
- anser as double value
-
getUnit
public java.lang.String getUnit()
Returns expected unit.- Returns:
- expected unit.
-
showSource
public void showSource()
Show source.
-
showConformable
public void showConformable()
Shows units, functions, and aliases conformable to given Value. (Originally part of 'tryallunits'.)
-
search
public void search()
Shows units and functions with names containing the current unit. (Originally part of 'tryallunits'.)
-
search
public void search(java.lang.String name)
Shows units and functions with names containing a given substring. (Originally part of 'tryallunits'.)- Parameters:
name
- the name of the unit.
-
showDef
public java.lang.String showDef(java.lang.String name)
If the argument is the name of a function or unit list, returns its definition. Otherwise returns null.- Parameters:
name
- the name.- Returns:
- definition or null.
-
help
public void help()
Show help topics in a window.
-
-
DMelt 3.0 © DataMelt by jWork.ORG