Class Force

All Implemented Interfaces:
Serializable

public class Force extends Measurement<ForceUnit>
Contains a force value and unit.
See Also:
  • Constructor Details

    • Force

      public Force(Number value, ForceUnit unit)
      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

      public boolean equals(Measurement<ForceUnit> other, double tolerance)
      Determines if two forces are equal up to a certain tolerance. If needed, this method attempts unit conversion to compare both objects.
      Overrides:
      equals in class Measurement<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

      public static void add(Force arg1, Force arg2, Force result)
      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

      public static Force addAndReturnNew(Force arg1, Force arg2, ForceUnit unit)
      Adds two force instances.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      unit - unit of returned force.
      Returns:
      a new instance containing result.
    • addAndReturnNew

      public Force addAndReturnNew(double value, ForceUnit unit, ForceUnit resultUnit)
      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

      public Force addAndReturnNew(Number value, ForceUnit unit, ForceUnit resultUnit)
      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

      public Force addAndReturnNew(Force s, ForceUnit unit)
      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

      public void add(double value, ForceUnit unit)
      Adds provided force value and unit and updates current force instance.
      Parameters:
      value - force value to be added.
      unit - unit of force value.
    • add

      public void add(Number value, ForceUnit unit)
      Adds provided force value and unit and updates current force instance.
      Parameters:
      value - force value to be added.
      unit - unit of force value.
    • add

      public void add(Force force)
      Adds provided force and updates current force.
      Parameters:
      force - force to be added.
    • add

      public void add(Force s, Force result)
      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

      public static void subtract(Force arg1, Force arg2, Force result)
      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

      public static Force subtractAndReturnNew(Force arg1, Force arg2, ForceUnit unit)
      Subtracts two force instances.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      unit - unit of returned force.
      Returns:
      a new instance containing result.
    • subtractAndReturnNew

      public Force subtractAndReturnNew(double value, ForceUnit unit, ForceUnit resultUnit)
      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

      public Force subtractAndReturnNew(Number value, ForceUnit unit, ForceUnit resultUnit)
      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

      public Force subtractAndReturnNew(Force s, ForceUnit unit)
      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

      public void subtract(double value, ForceUnit unit)
      Subtracts provided force value and unit and updates current force instance.
      Parameters:
      value - force value to be subtracted.
      unit - unit of force value.
    • subtract

      public void subtract(Number value, ForceUnit unit)
      Subtracts provided force value and unit and updates current force instance.
      Parameters:
      value - force value to be subtracted.
      unit - unit of force value.
    • subtract

      public void subtract(Force force)
      Subtracts provided force and updates current force.
      Parameters:
      force - force to be subtracted.
    • subtract

      public void subtract(Force s, Force result)
      Subtracts provided force and stores the result into provided force.
      Parameters:
      s - force to be subtracted.
      result - instance where result will be stored.