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