|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.nc2.units.SimpleUnit
public class SimpleUnit
Convenience routines on top of ucar.units package. The ucar.units package handles
| Field Summary | |
|---|---|
protected static Unit |
dateUnit
|
protected static boolean |
debugParse
|
protected static UnitFormat |
format
|
protected static Unit |
secsUnit
|
protected Unit |
uu
|
| Constructor Summary | |
|---|---|
protected |
SimpleUnit()
for subclasses. |
| Method Summary | |
|---|---|
double |
convertTo(double value,
SimpleUnit outputUnit)
Convert given value of this unit to the new unit. |
static SimpleUnit |
factory(java.lang.String name)
Create a SimpleUnit from the given name, catch Exceptions. |
static SimpleUnit |
factoryWithExceptions(java.lang.String name)
Create a SimpleUnit from the given name, allow Exceptions. |
static double |
getConversionFactor(java.lang.String inputUnitString,
java.lang.String outputUnitString)
Get the conversion factor to convert unputUnit to outputUnit. |
Unit |
getUnit()
Get underlying ucar.units.Unit. |
java.lang.String |
getUnitString()
Extract the simple unit string (no number), eg "s" or "m". |
double |
getValue()
Extract the value, can only be called for ScaledUnit. |
boolean |
isCompatible(java.lang.String unitString)
Return true if unitString1 is compatible to unitString2, meaning one can be converted to the other. |
static boolean |
isCompatible(java.lang.String unitString1,
java.lang.String unitString2)
Return true if unitString1 is compatible to unitString2, meaning one can be converted to the other. |
static boolean |
isCompatibleWithExceptions(java.lang.String unitString1,
java.lang.String unitString2)
Return true if unitString1 is convertible to unitString2 |
static boolean |
isDateUnit(java.lang.String unitString)
Return true if the given unit is convertible to a date Unit. |
static boolean |
isDateUnit(Unit uu)
Return true if this ucar.units.Unit is a Date. |
static boolean |
isTimeUnit(java.lang.String unitString)
Return true if the given unit is a time Unit, eg "seconds". |
static boolean |
isTimeUnit(Unit uu)
Return true if this ucar.units.Unit is convertible to secs. |
boolean |
isUnknownUnit()
Is this an instance of an UnknownUnit? |
protected static Unit |
makeUnit(java.lang.String name)
|
java.lang.String |
toString()
Unit string representation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static UnitFormat format
protected static Unit secsUnit
protected static Unit dateUnit
protected static boolean debugParse
protected Unit uu
| Constructor Detail |
|---|
protected SimpleUnit()
| Method Detail |
|---|
public static SimpleUnit factory(java.lang.String name)
name - parse this name to create a unit.
UnitFormat.parse(java.lang.String)
public static SimpleUnit factoryWithExceptions(java.lang.String name)
throws java.lang.Exception
name - parse this name to create a unit.
java.lang.ExceptionUnitFormat.parse(java.lang.String)
protected static Unit makeUnit(java.lang.String name)
throws java.lang.Exception
java.lang.Exception
public static boolean isCompatible(java.lang.String unitString1,
java.lang.String unitString2)
public static boolean isCompatibleWithExceptions(java.lang.String unitString1,
java.lang.String unitString2)
throws java.lang.Exception
java.lang.Exceptionpublic static boolean isDateUnit(Unit uu)
public static boolean isTimeUnit(Unit uu)
public static boolean isDateUnit(java.lang.String unitString)
[-]Y[Y[Y[Y]]]-MM-DD[(T| )hh[:mm[:ss[.sss*]]][ [+|-]hh[[:]mm]]]
public static boolean isTimeUnit(java.lang.String unitString)
public static double getConversionFactor(java.lang.String inputUnitString,
java.lang.String outputUnitString)
throws ConversionException
inputUnitString - outputUnitString -
ConversionExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic Unit getUnit()
public double convertTo(double value,
SimpleUnit outputUnit)
throws ConversionException
ConversionExceptionpublic boolean isCompatible(java.lang.String unitString)
public boolean isUnknownUnit()
public double getValue()
public java.lang.String getUnitString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||