Package com.irurueta.units
Class Speed
- All Implemented Interfaces:
Serializable
Contains a speed value and unit.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds provided speed value and unit and updates current speed instance.static doubleAdds two speed values and units and returns the result.voidAdds provided speed and updates current speed.voidAdds provided speed and stores the result into provided speed.static voidAdds two speed instances and stores the result into provided instance.voidAdds provided speed value and unit and updates current speed instance.static NumberAdds two speed values and unit and returns the result.addAndReturnNew(double value, SpeedUnit unit, SpeedUnit resultUnit) Adds provided speed value and unit and returns a new speed instance using provided unit.static SpeedaddAndReturnNew(Speed arg1, Speed arg2, SpeedUnit unit) Adds two speed instances.addAndReturnNew(Speed s, SpeedUnit unit) Adds provided speed to current instance and returns a new speed.addAndReturnNew(Number value, SpeedUnit unit, SpeedUnit resultUnit) Adds provided speed value and unit and returns a new speed instance using provided unit.booleanequals(Measurement<SpeedUnit> other, double tolerance) Determines if two speeds are equal up to a certain tolerance.voidSubtracts provided speed value and unit and updates current speed instance.static doubleSubtracts two speed values and units and returns the result.voidSubtracts provided speed and updates current speed.voidSubtracts provided speed and stores the result into provided speed.static voidSubtracts two speed instances and stores the result into provided instance.voidSubtracts provided speed value and unit and updates current speed instance.static NumberSubtracts two speed values and units and returns the result.subtractAndReturnNew(double value, SpeedUnit unit, SpeedUnit resultUnit) Subtracts provided speed value and unit and returns a nw speed instance using provided unit.static SpeedsubtractAndReturnNew(Speed arg1, Speed arg2, SpeedUnit unit) Subtracts two speed instances.subtractAndReturnNew(Speed s, SpeedUnit unit) Subtracts provided speed to current instance and returns a new speed instance.subtractAndReturnNew(Number value, SpeedUnit unit, SpeedUnit resultUnit) Subtracts provided speed value and unit and returns a new speed instance using provided unit.
-
Constructor Details
-
Speed
Constructor with value and unit.- Parameters:
value- speed value.unit- unit of speed.- Throws:
IllegalArgumentException- if either value or unit is null.
-
Speed
Speed()Constructor.
-
-
Method Details
-
equals
Determines if two speeds are equal up to a certain tolerance. If needed, this method attempts unit conversion to compare both objects.- Overrides:
equalsin classMeasurement<SpeedUnit>- Parameters:
other- another speed to compare.tolerance- amount of tolerance to determine whether two speed instances are equal or not.- Returns:
- true if provided speed is assumed to be equal to this instance, false otherwise.
-
add
public static double add(double value1, SpeedUnit unit1, double value2, SpeedUnit unit2, SpeedUnit resultUnit) Adds two speed 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, SpeedUnit unit1, Number value2, SpeedUnit unit2, SpeedUnit resultUnit) Adds two speed 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 addition.
-
add
Adds two speed 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 speed instances.- Parameters:
arg1- 1st argument.arg2- 2nd argument.unit- unit of returned speed.- Returns:
- a new instance containing result.
-
addAndReturnNew
Adds provided speed value and unit and returns a new speed instance using provided unit.- Parameters:
value- value to be added.unit- unit of value to be added.resultUnit- unit of returned speed.- Returns:
- a new speed containing result.
-
addAndReturnNew
Adds provided speed value and unit and returns a new speed instance using provided unit.- Parameters:
value- value to be added.unit- unit of value to be added.resultUnit- unit of returned speed.- Returns:
- a new speed containing result.
-
addAndReturnNew
Adds provided speed to current instance and returns a new speed.- Parameters:
s- speed to be added.unit- unit of returned speed.- Returns:
- a new speed containing result.
-
add
Adds provided speed value and unit and updates current speed instance.- Parameters:
value- speed value to be added.unit- unit of speed value.
-
add
Adds provided speed value and unit and updates current speed instance.- Parameters:
value- speed value to be added.unit- unit of speed value.
-
add
Adds provided speed and updates current speed.- Parameters:
speed- speed to be added.
-
add
Adds provided speed and stores the result into provided speed.- Parameters:
s- speed to be added.result- instance where result will be stored.
-
subtract
public static double subtract(double value1, SpeedUnit unit1, double value2, SpeedUnit unit2, SpeedUnit resultUnit) Subtracts two speed 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, SpeedUnit unit1, Number value2, SpeedUnit unit2, SpeedUnit resultUnit) Subtracts two speed 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 speed instances and stores the result into provided instance.- Parameters:
arg1- 1st argument.arg2- 2nd argument.result- instance where result will be stored.
-
subtractAndReturnNew
Subtracts two speed instances.- Parameters:
arg1- 1st argument.arg2- 2nd argument.unit- unit of returned speed.- Returns:
- a new instance containing result.
-
subtractAndReturnNew
Subtracts provided speed value and unit and returns a nw speed instance using provided unit.- Parameters:
value- value to be subtracted.unit- unit of value to be subtracted.resultUnit- unit of returned speed.- Returns:
- a new speed containing result.
-
subtractAndReturnNew
Subtracts provided speed value and unit and returns a new speed instance using provided unit.- Parameters:
value- value to be subtracted.unit- unit of value to be subtracted.resultUnit- unit of returned speed.- Returns:
- a new speed containing result.
-
subtractAndReturnNew
Subtracts provided speed to current instance and returns a new speed instance.- Parameters:
s- speed to be subtracted.unit- unit of returned speed.- Returns:
- a new speed containing result.
-
subtract
Subtracts provided speed value and unit and updates current speed instance.- Parameters:
value- speed value to be subtracted.unit- unit of speed value.
-
subtract
Subtracts provided speed value and unit and updates current speed instance.- Parameters:
value- speed value to be subtracted.unit- unit of speed value.
-
subtract
Subtracts provided speed and updates current speed.- Parameters:
speed- speed to be subtracted.
-
subtract
Subtracts provided speed and stores the result into provided speed.- Parameters:
s- speed to be subtracted.result- instance where result will be stored.
-