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