public class UnitConverter
extends java.lang.Object
Constructor and Description |
---|
UnitConverter() |
Modifier and Type | Method and Description |
---|---|
static double |
convertDuration(long timeSpanInMilliseconds,
TimeUnit desiredTimeUnit)
Convert a duration of milliseconds into the specified
TimeUnit . |
static long |
convertDurationToMilliseconds(double timeSpan,
TimeUnit timeUnit)
Converts a duration with a specified
TimeUnit to milliseconds. |
static long |
convertDurationToMilliseconds(Duration duration)
Converts a duration to milliseconds.
|
static double |
convertEnergyAmount(EnergyAmount energyAmount,
EnergyUnitFactorPrefixSI newSIPrefix,
TimeUnit newTimeUnit)
Converts an energy amount into specified SI-prefix and TimeUnit.
|
static double |
convertEnergyFlowInWatt(double energyFlowValueInWatt,
EnergyUnitFactorPrefixSI desiredUnit)
Converts the specified value of an energy flow in Watt as new value with the specified SI-Prefix
(e.g 10.000 into 10 for 10.000 W into 10 kW).
|
static EnergyFlowInWatt |
convertEnergyFlowInWatt(EnergyFlowInWatt energyflow,
EnergyUnitFactorPrefixSI desiredSIprefix)
Converts the specified
EnergyFlowInWatt into the desired SI-prefix
(e.g 10.000 kW into 10 MW, while setting the desired SI-prefix to EnergyUnitFactorPrefixSI.MEGA_M_6 ). |
static double |
convertEnergyFlowToWatt(EnergyFlowInWatt energyflow)
Returns the value of the specified
EnergyFlowInWatt into Watt (e.g 10 kW into 10.000 W). |
static GoodFlow |
convertGoodFlow(GoodFlow goodFlow,
TimeUnit timeUnitBase2Use)
|
public static long convertDurationToMilliseconds(double timeSpan, TimeUnit timeUnit)
TimeUnit
to milliseconds.timeSpan
- the time spantimeUnit
- the TimeUnit
public static long convertDurationToMilliseconds(Duration duration)
null
.duration
- the durationpublic static double convertDuration(long timeSpanInMilliseconds, TimeUnit desiredTimeUnit)
TimeUnit
.timeSpanInMilliseconds
- the time span in millisecondsdesiredTimeUnit
- the desired time unitpublic static double convertEnergyFlowToWatt(EnergyFlowInWatt energyflow)
EnergyFlowInWatt
into Watt (e.g 10 kW into 10.000 W).energyflow
- the energypublic static double convertEnergyFlowInWatt(double energyFlowValueInWatt, EnergyUnitFactorPrefixSI desiredUnit)
energyFlowValueInWatt
- the energy flow value in wattdesiredUnit
- the desired unitpublic static EnergyFlowInWatt convertEnergyFlowInWatt(EnergyFlowInWatt energyflow, EnergyUnitFactorPrefixSI desiredSIprefix)
EnergyFlowInWatt
into the desired SI-prefix
(e.g 10.000 kW into 10 MW, while setting the desired SI-prefix to EnergyUnitFactorPrefixSI.MEGA_M_6
).energyflow
- the energy to convertdesiredSIprefix
- the desired prefixpublic static double convertEnergyAmount(EnergyAmount energyAmount, EnergyUnitFactorPrefixSI newSIPrefix, TimeUnit newTimeUnit)
energyAmount
- the current energy amount that shall be convertednewSIPrefix
- the new SI prefix, like 'k', 'M' and so onnewTimeUnit
- the new time unit, e.g. h (Hours), d (days)