Package com.irurueta.units
Class Temperature
- All Implemented Interfaces:
Serializable
Contains a temperature value and unit.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Temperature(Number value, TemperatureUnit unit) Constructor with value and unit. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value, TemperatureUnit unit) Adds provided temperature value and unit and updates current temperature instance.static doubleadd(double value1, TemperatureUnit unit1, double value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Adds two temperature values and units and returns the result.voidadd(Temperature temperature) Adds provided temperature and updates current temperature instance.voidadd(Temperature t, Temperature result) Adds provided temperature and stores the result into provided temperature instance.static voidadd(Temperature arg1, Temperature arg2, Temperature result) Adds two temperature instances and stores the result into provided instance.voidadd(Number value, TemperatureUnit unit) Adds provided temperature value and unit and updates current temperature instance.static Numberadd(Number value1, TemperatureUnit unit1, Number value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Adds two temperature values and units and returns the result.addAndReturnNew(double value, TemperatureUnit unit, TemperatureUnit resultUnit) Adds provided temperature value and unit and returns a new temperature instance using provided unit.static TemperatureaddAndReturnNew(Temperature arg1, Temperature arg2, TemperatureUnit unit) Adds two temperature instances.addAndReturnNew(Temperature t, TemperatureUnit unit) Adds provided temperature to current instance and returns a new temperature instance.addAndReturnNew(Number value, TemperatureUnit unit, TemperatureUnit resultUnit) Adds provided temperature value and unit and returns a new temperature instance using provided unit.booleanequals(Measurement<TemperatureUnit> other, double tolerance) Determines if two temperatures are equal up to a certain tolerance.voidsubtract(double value, TemperatureUnit unit) Subtracts provided temperature value and unit and updates current temperature instance.static doublesubtract(double value1, TemperatureUnit unit1, double value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Subtracts two temperature values and unit and returns the result.voidsubtract(Temperature temperature) Subtracts provided temperature and updates current temperature.voidsubtract(Temperature t, Temperature result) Subtracts provided temperature and stores the result into provided temperature.static voidsubtract(Temperature arg1, Temperature arg2, Temperature result) Subtracts two temperature instances and stores the result into provided instance.voidsubtract(Number value, TemperatureUnit unit) Subtracts provided temperature value and unit and updates current temperature instance.static Numbersubtract(Number value1, TemperatureUnit unit1, Number value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Subtracts two temperature values and units and returns the result.subtractAndReturnNew(double value, TemperatureUnit unit, TemperatureUnit resultUnit) Subtracts provided temperature value and unit and returns a new temperature instance using provided unit.static TemperaturesubtractAndReturnNew(Temperature arg1, Temperature arg2, TemperatureUnit unit) Subtracts two temperature instances.Subtracts provided temperature from current instance and returns a new instance.subtractAndReturnNew(Number value, TemperatureUnit unit, TemperatureUnit resultUnit) Subtracts provided temperature value and unit and returns a new temperature instance using provided unit.
-
Constructor Details
-
Temperature
Constructor with value and unit.- Parameters:
value- temperature value.unit- unit of temperature.- Throws:
IllegalArgumentException- if either value or unit is null.
-
Temperature
Temperature()Constructor.
-
-
Method Details
-
equals
Determines if two temperatures are equal up to a certain tolerance. If needed, this method attempts unit conversion to compare both objects.- Overrides:
equalsin classMeasurement<TemperatureUnit>- Parameters:
other- another measurement to compare.tolerance- amount of tolerance to determine whether two temperature instances are equal or not.- Returns:
- true if provided temperature is assumed to be equal to this instance, false otherwise.
-
add
public static double add(double value1, TemperatureUnit unit1, double value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Adds two temperature values and units and returns the result.- Parameters:
value1- 1st argument value.unit1- 1st argument unit.value2- 2nd argument value.unit2- 2nd argument unit.resultUnit- unit of result to be returned.- Returns:
- result of addition.
-
add
public static Number add(Number value1, TemperatureUnit unit1, Number value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Adds two temperature values and units and returns the result.- Parameters:
value1- 1st argument value.unit1- 1st argument unit.value2- 2nd argument value.unit2- 2nd argument unit.resultUnit- unit of result to be returned.- Returns:
- result of addition.
-
add
Adds two temperature instances and stores the result into provided instance.- Parameters:
arg1- 1st argument.arg2- 2nd argument.result- instance where result will be stored.
-
addAndReturnNew
Adds two temperature instances.- Parameters:
arg1- 1st argument.arg2- 2nd argument.unit- unit of returned temperature.- Returns:
- a new instance containing result.
-
addAndReturnNew
Adds provided temperature value and unit and returns a new temperature instance using provided unit.- Parameters:
value- value to be added.unit- unit of value to be added.resultUnit- unit of returned temperature.- Returns:
- a new temperature containing result.
-
addAndReturnNew
Adds provided temperature value and unit and returns a new temperature instance using provided unit.- Parameters:
value- value to be added.unit- unit of value to be added.resultUnit- unit of returned temperature.- Returns:
- a new temperature containing result.
-
addAndReturnNew
Adds provided temperature to current instance and returns a new temperature instance.- Parameters:
t- temperature to be added.unit- unit of returned temperature.- Returns:
- a new temperature containing result.
-
add
Adds provided temperature value and unit and updates current temperature instance.- Parameters:
value- temperature value to be added.unit- unit of temperature value.
-
add
Adds provided temperature value and unit and updates current temperature instance.- Parameters:
value- temperature value to be added.unit- unit of temperature value.
-
add
Adds provided temperature and updates current temperature instance.- Parameters:
temperature- temperature to be added.
-
add
Adds provided temperature and stores the result into provided temperature instance.- Parameters:
t- temperature to be added.result- instance where result will be stored.
-
subtract
public static double subtract(double value1, TemperatureUnit unit1, double value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Subtracts two temperature values and unit and returns the result.- Parameters:
value1- 1st argument value.unit1- 1st argument unit.value2- 2nd argument value.unit2- 2nd argument unit.resultUnit- unit of result to be returned.- Returns:
- result of subtraction.
-
subtract
public static Number subtract(Number value1, TemperatureUnit unit1, Number value2, TemperatureUnit unit2, TemperatureUnit resultUnit) Subtracts two temperature values and units and returns the result.- Parameters:
value1- 1st argument value.unit1- 1st argument unit.value2- 2nd argument value.unit2- 2nd argument unit.resultUnit- unit of result to be returned.- Returns:
- result of subtraction.
-
subtract
Subtracts two temperature instances and stores the result into provided instance.- Parameters:
arg1- 1st argument.arg2- 2nd argument.result- instance where result will be stored.
-
subtractAndReturnNew
public static Temperature subtractAndReturnNew(Temperature arg1, Temperature arg2, TemperatureUnit unit) Subtracts two temperature instances.- Parameters:
arg1- 1st argument.arg2- 2nd argument.unit- unit of returned temperature.- Returns:
- a new instance containing result.
-
subtractAndReturnNew
public Temperature subtractAndReturnNew(double value, TemperatureUnit unit, TemperatureUnit resultUnit) Subtracts provided temperature value and unit and returns a new temperature instance using provided unit.- Parameters:
value- value to be subtracted.unit- unit of value to be subtracted.resultUnit- unit of returned temperature.- Returns:
- a new temperature containing result.
-
subtractAndReturnNew
public Temperature subtractAndReturnNew(Number value, TemperatureUnit unit, TemperatureUnit resultUnit) Subtracts provided temperature value and unit and returns a new temperature instance using provided unit.- Parameters:
value- value to be subtracted.unit- unit of value to be subtracted.resultUnit- unit of returned temperature.- Returns:
- a new temperature containing result.
-
subtractAndReturnNew
Subtracts provided temperature from current instance and returns a new instance.- Parameters:
t- temperature to be subtracted.unit- unit of returned temperature.- Returns:
- a new temperature containing result.
-
subtract
Subtracts provided temperature value and unit and updates current temperature instance.- Parameters:
value- temperature value to be subtracted.unit- unit of temperature value.
-
subtract
Subtracts provided temperature value and unit and updates current temperature instance.- Parameters:
value- temperature value to be subtracted.unit- unit of temperature value.
-
subtract
Subtracts provided temperature and updates current temperature.- Parameters:
temperature- temperature to be subtracted.
-
subtract
Subtracts provided temperature and stores the result into provided temperature.- Parameters:
t- temperature to be subtracted.result- instance where result will be stored.
-