Package com.irurueta.units
Class EnergyConverter
java.lang.Object
com.irurueta.units.EnergyConverter
Does energy conversions to different units.
To prevent loss of accuracy, conversion should only be done as a final step
before displaying energy measurements.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final doubleNumber of joules in 1 International Table BTU.(package private) static final doubleNumber of joules in 1 thermochemical calorie.(package private) static final doubleNumber of joules in 1 thermochemical kilocalorie.(package private) static final doubleNumber of joules in 1 kilojoule.(package private) static final doubleNumber of joules in 1 kilowatt hour.(package private) static final doubleNumber of joules in 1 megajoule. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublebtuToJoule(double btu) Converts provided BTU value to joules.static doublecalorieToJoule(double calorie) Converts provided calorie value to joules.static doubleconvert(double input, EnergyUnit inputUnit, EnergyUnit outputUnit) Converts an energy value from input unit to provided output unit.static voidConverts an energy instance to provided output energy unit.static voidconvert(Energy energy, EnergyUnit outputUnit) Converts and updates an energy to requested output unit.static voidconvert(Energy input, EnergyUnit outputUnit, Energy result) Converts an energy to requested output unit.static Numberconvert(Number input, EnergyUnit inputUnit, EnergyUnit outputUnit) Converts an energy value from input unit to provided output unit.static EnergyconvertAndReturnNew(Energy input, EnergyUnit outputUnit) Converts an energy instance to requested output unit.static doublejouleToBtu(double joule) Converts provided joules value to BTU.static doublejouleToCalorie(double joule) Converts provided joules value to calorie.static doublejouleToKilocalorie(double joule) Converts provided joules value to kilocalorie.static doublejouleToKilojoule(double joule) Converts provided joules value to kilojoule.static doublejouleToKilowattHour(double joule) Converts provided joules value to kilowatt hour.static doublejouleToMegajoule(double joule) Converts provided joules value to megajoule.static doublekilocalorieToJoule(double kilocalorie) Converts provided kilocalorie value to joules.static doublekilojouleToJoule(double kilojoule) Converts provided kilojoule value to joules.static doublekilowattHourToJoule(double kilowattHour) Converts provided kilowatt hour value to joules.static doublemegajouleToJoule(double megajoule) Converts provided megajoule value to joules.
-
Field Details
-
JOULES_PER_KILOJOULE
static final double JOULES_PER_KILOJOULENumber of joules in 1 kilojoule.- See Also:
-
JOULES_PER_MEGAJOULE
static final double JOULES_PER_MEGAJOULENumber of joules in 1 megajoule.- See Also:
-
JOULES_PER_CALORIE
static final double JOULES_PER_CALORIENumber of joules in 1 thermochemical calorie.- See Also:
-
JOULES_PER_KILOCALORIE
static final double JOULES_PER_KILOCALORIENumber of joules in 1 thermochemical kilocalorie.- See Also:
-
JOULES_PER_KILOWATT_HOUR
static final double JOULES_PER_KILOWATT_HOURNumber of joules in 1 kilowatt hour.- See Also:
-
JOULES_PER_BTU
static final double JOULES_PER_BTUNumber of joules in 1 International Table BTU.- See Also:
-
-
Constructor Details
-
EnergyConverter
private EnergyConverter()Constructor. Prevents instantiation of helper class.
-
-
Method Details
-
convert
Converts an energy instance to provided output energy unit.- Parameters:
input- input energy to be converted.output- output energy where result will be stored containing output unit.
-
convertAndReturnNew
Converts an energy instance to requested output unit.- Parameters:
input- input energy to be converted.outputUnit- requested output unit.- Returns:
- converted energy.
-
convert
Converts and updates an energy to requested output unit.- Parameters:
energy- input energy to be converted and updated.outputUnit- requested output unit.
-
convert
Converts an energy to requested output unit.- Parameters:
input- input energy to be converted.outputUnit- requested output unit.result- energy instance where result will be stored.
-
convert
Converts an energy value from input unit to provided output unit.- Parameters:
input- energy value.inputUnit- input energy unit.outputUnit- output energy unit.- Returns:
- converted energy value.
-
convert
Converts an energy value from input unit to provided output unit.- Parameters:
input- energy value.inputUnit- input energy unit.outputUnit- output energy unit.- Returns:
- converted energy value.
-
kilojouleToJoule
public static double kilojouleToJoule(double kilojoule) Converts provided kilojoule value to joules.- Parameters:
kilojoule- kilojoule value.- Returns:
- same energy converted to joules.
-
jouleToKilojoule
public static double jouleToKilojoule(double joule) Converts provided joules value to kilojoule.- Parameters:
joule- joules value.- Returns:
- same energy converted to kilojoule.
-
megajouleToJoule
public static double megajouleToJoule(double megajoule) Converts provided megajoule value to joules.- Parameters:
megajoule- megajoule value.- Returns:
- same energy converted to joules.
-
jouleToMegajoule
public static double jouleToMegajoule(double joule) Converts provided joules value to megajoule.- Parameters:
joule- joules value.- Returns:
- same energy converted to megajoule.
-
calorieToJoule
public static double calorieToJoule(double calorie) Converts provided calorie value to joules.- Parameters:
calorie- calorie value.- Returns:
- same energy converted to joules.
-
jouleToCalorie
public static double jouleToCalorie(double joule) Converts provided joules value to calorie.- Parameters:
joule- joules value.- Returns:
- same energy converted to calorie.
-
kilocalorieToJoule
public static double kilocalorieToJoule(double kilocalorie) Converts provided kilocalorie value to joules.- Parameters:
kilocalorie- kilocalorie value.- Returns:
- same energy converted to joules.
-
jouleToKilocalorie
public static double jouleToKilocalorie(double joule) Converts provided joules value to kilocalorie.- Parameters:
joule- joules value.- Returns:
- same energy converted to kilocalorie.
-
kilowattHourToJoule
public static double kilowattHourToJoule(double kilowattHour) Converts provided kilowatt hour value to joules.- Parameters:
kilowattHour- kilowatt hour value.- Returns:
- same energy converted to joules.
-
jouleToKilowattHour
public static double jouleToKilowattHour(double joule) Converts provided joules value to kilowatt hour.- Parameters:
joule- joules value.- Returns:
- same energy converted to kilowatt hour.
-
btuToJoule
public static double btuToJoule(double btu) Converts provided BTU value to joules.- Parameters:
btu- BTU value.- Returns:
- same energy converted to joules.
-
jouleToBtu
public static double jouleToBtu(double joule) Converts provided joules value to BTU.- Parameters:
joule- joules value.- Returns:
- same energy converted to BTU.
-