|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectspv.util.Units
spv.util.XUnits
public class XUnits
This class supports physical units associated with the independent variable.
The standard units associated with the independent variable is "Angstrom".
Static methods in this class support conversion of entire arrays
of double data (for the sake of efficiency).
Currently supported units are:
"Angstrom", "micron", "nm", "cm", "m", "Hz", "kHz", "MHz", "GHz", "THz", "eV", "keV", "MeV", "1/micron".
Note that the "micron" value is specified as the string
'?' + "m" since a unicode value is present.
Alternate forms are "micron", "microns" and "um", with any
capitalization.
| Nested Class Summary | |
|---|---|
(package private) static interface |
XUnits.Converter
|
private static class |
XUnits.SymmetricalConverter
|
private static class |
XUnits.WavelengthConverter
|
| Field Summary | |
|---|---|
private static java.lang.String |
ANGSTROM_STRING
|
static java.lang.String |
BIN_NUMBER
If units is set to this value, all returned arrays contain bin numbers. |
private static java.lang.String |
CENTIMETER_STRING
|
protected XUnits.Converter |
converter
|
protected static KeyedVector |
converters
|
static java.util.Map<java.lang.String,java.lang.String> |
correct
|
private static java.lang.String |
ENERGY_LABEL
|
private static java.lang.String |
ENERGY_UCD
|
private static java.lang.String |
EV_STRING
|
private static java.lang.String |
FREQUENCY_LABEL
|
private static java.lang.String |
FREQUENCY_UCD
|
private static java.lang.String |
GHZ_STRING
|
private static java.lang.String |
HZ_STRING
|
private static java.lang.String |
KEV_STRING
|
private static java.lang.String |
KHZ_STRING
|
private static java.lang.String |
METER_STRING
|
private static java.lang.String |
MEV_STRING
|
private static java.lang.String |
MHZ_STRING
|
private static java.lang.String |
MICRON_STRING
|
private static java.lang.String |
MILLIMETER_STRING
|
private static java.lang.String |
NANOMETER_STRING
|
private static java.util.Map<java.lang.String,java.lang.String> |
sed
|
(package private) static long |
serialVersionUID
|
private static java.lang.String |
THZ_STRING
|
private static java.lang.String |
WAVELENGTH_LABEL
|
private static java.lang.String |
WAVELENGTH_UCD
|
private static java.lang.String |
WAVENUMBER_LABEL
|
static java.lang.String |
WAVENUMBER_STRING
|
private static java.lang.String |
WAVENUMBER_UCD
|
| Fields inherited from class spv.util.Units |
|---|
C, E, ERROR_MSG, H, original_spelling, ucd, UNITLESS, units_string |
| Fields inherited from interface spv.util.Constant |
|---|
DATA_MARKER, DMAX, DMIN, IINDEF, IMAX, IMIN, MODEL_ID, NORMALIZED_ID, RESIDUALS_ID |
| Constructor Summary | |
|---|---|
XUnits()
|
|
XUnits(java.lang.String arg)
Constructor. |
|
XUnits(XUnits units)
Constructor. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a clone copy of this object. |
static double[] |
convert(double[] x,
XUnits xunit,
XUnits nunit)
Converts independent variable array from one unit to another. |
double |
convertFromStandardUnits(double value,
double avalue)
Converts argument from standard units to this units. |
double |
convertToStandardUnits(double value,
double avalue)
Converts argument from this units to standard units. |
protected void |
getConverterObject()
Grabs and stores the object that converts this units type to/from standard units. |
static java.lang.String |
GetCorrectSpelling(java.lang.String value)
Corrects spelling errors. |
java.lang.String |
getLabel()
Returns a string appropriate to be used as a label in the X axis. |
static Units |
GetPreferredUnits()
Returns the preferred independent variable units. |
java.lang.String |
getSEDSpelling()
Returns the units string spelled according to SED specs. |
static XUnits |
GetStandardUnits()
Returns the standard independent variable units. |
java.util.Enumeration |
getSupportedUnits()
Returns an Enumeration with the string
designations of all supported units for the independent variable. |
java.lang.String |
getUCD()
Returns a string appropriate to be used as a UCD. |
static java.lang.String[] |
GetUnitsStrings()
Gets an array with the strings representing all valid X units. |
boolean |
isValid()
Checks if this units instance is internally consistent; that is, its string representation matches one of the supported units types. |
static boolean |
IsValidUnits(Units units)
Checks if the supplied Units instance is a
valid independent variable units. |
static void |
main(java.lang.String[] args)
Self-test. |
| Methods inherited from class spv.util.Units |
|---|
equals, getOriginalSpelling, hashCode, setFromString, setUCD, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final long serialVersionUID
protected XUnits.Converter converter
public static final java.lang.String BIN_NUMBER
private static final java.lang.String ANGSTROM_STRING
private static final java.lang.String NANOMETER_STRING
private static final java.lang.String MICRON_STRING
private static final java.lang.String MILLIMETER_STRING
private static final java.lang.String CENTIMETER_STRING
private static final java.lang.String METER_STRING
private static final java.lang.String EV_STRING
private static final java.lang.String KEV_STRING
private static final java.lang.String MEV_STRING
private static final java.lang.String HZ_STRING
private static final java.lang.String KHZ_STRING
private static final java.lang.String MHZ_STRING
private static final java.lang.String GHZ_STRING
private static final java.lang.String THZ_STRING
public static final java.lang.String WAVENUMBER_STRING
private static final java.lang.String WAVELENGTH_LABEL
private static final java.lang.String ENERGY_LABEL
private static final java.lang.String FREQUENCY_LABEL
private static final java.lang.String WAVENUMBER_LABEL
private static final java.lang.String WAVELENGTH_UCD
private static final java.lang.String WAVENUMBER_UCD
private static final java.lang.String FREQUENCY_UCD
private static final java.lang.String ENERGY_UCD
public static java.util.Map<java.lang.String,java.lang.String> correct
private static java.util.Map<java.lang.String,java.lang.String> sed
protected static KeyedVector converters
| Constructor Detail |
|---|
public XUnits()
public XUnits(java.lang.String arg)
This constructor is capable of fixing some common mispellings and alternate spellings.
arg - string with the unitspublic XUnits(XUnits units)
units - a pre-existing XUnits instance| Method Detail |
|---|
public static java.lang.String GetCorrectSpelling(java.lang.String value)
value - the input string
public static java.lang.String[] GetUnitsStrings()
public boolean isValid()
isValid in class Unitstrue if this is a valid instancepublic java.lang.String getLabel()
getLabel in class Unitsnull if the
units type is not supported.public java.lang.String getSEDSpelling()
getSEDSpelling in class Unitspublic java.lang.String getUCD()
getUCD in class Unitsnull if the
units type is not supported.public static XUnits GetStandardUnits()
public static Units GetPreferredUnits()
public java.util.Enumeration getSupportedUnits()
Enumeration with the string
designations of all supported units for the independent variable.
getSupportedUnits in class UnitsEnumeration with all supported
units for the independent variablepublic static boolean IsValidUnits(Units units)
Units instance is a
valid independent variable units.
units - the units to be tested
true if the supplied Units
instance is a valid independent variable units,
false otherwise.
public double convertToStandardUnits(double value,
double avalue)
convertToStandardUnits in class Unitsvalue - the value expressed in this unitsavalue - auxiliary value expressed in standard units,.
Not used.
public double convertFromStandardUnits(double value,
double avalue)
convertFromStandardUnits in class Unitsvalue - the value expressed in standard unitsavalue - auxiliary value expressed in standard units.
Not used.
protected void getConverterObject()
null.
getConverterObject in class Units
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class Unitsjava.lang.CloneNotSupportedException
public static double[] convert(double[] x,
XUnits xunit,
XUnits nunit)
throws UnitsException
x - the independent variable array, usually wavelength.xunit - independent variable unitsnunit - independent variable new (output) units
UnitsException - if the units aren't of the appropriate typepublic static void main(java.lang.String[] args)
% java spv.util.XUnits
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||