Class Angle

All Implemented Interfaces:
Serializable

public class Angle extends Measurement<AngleUnit>
Contains angle value and unit.
See Also:
  • Constructor Details

    • Angle

      public Angle(Number value, AngleUnit unit)
      Constructor with value and unit.
      Parameters:
      value - angle value.
      unit - unit of angle.
      Throws:
      IllegalArgumentException - if either value or unit is null.
    • Angle

      Angle()
      Constructor.
  • Method Details

    • equals

      public boolean equals(Measurement<AngleUnit> other, double tolerance)
      Determines if two angles are equal up to a certain tolerance. If needed, this method attempts unit conversion to compare both objects.
      Overrides:
      equals in class Measurement<AngleUnit>
      Parameters:
      other - another measurement to compare.
      tolerance - amount of tolerance to determine whether two angle instances are equal or not.
      Returns:
      true if provided angle is assumed to be equal to this instance, false otherwise.
    • add

      public static double add(double value1, AngleUnit unit1, double value2, AngleUnit unit2, AngleUnit resultUnit)
      Adds two angle 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, AngleUnit unit1, Number value2, AngleUnit unit2, AngleUnit resultUnit)
      Adds two angle 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 void add(Angle arg1, Angle arg2, Angle result)
      Adds two angles and stores the result into provided instance.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      result - instance where result will be stored.
    • addAndReturnNew

      public static Angle addAndReturnNew(Angle arg1, Angle arg2, AngleUnit unit)
      Adds two angles.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      unit - unit of returned angle.
      Returns:
      a new instance containing result.
    • addAndReturnNew

      public Angle addAndReturnNew(double value, AngleUnit unit, AngleUnit resultUnit)
      Adds provided angle value and unit and returns a new angle instance using provided unit.
      Parameters:
      value - value to be added.
      unit - unit of value to be added.
      resultUnit - unit of returned angle.
      Returns:
      a new angle containing result.
    • addAndReturnNew

      public Angle addAndReturnNew(Number value, AngleUnit unit, AngleUnit resultUnit)
      Adds provided angle value and unit and returns a new angle instance using provided unit.
      Parameters:
      value - value to be added.
      unit - unit of value to be added.
      resultUnit - unit of returned angle.
      Returns:
      a new angle containing result.
    • addAndReturnNew

      public Angle addAndReturnNew(Angle a, AngleUnit unit)
      Adds provided angle to current instance and returns a new angle.
      Parameters:
      a - angle to be added.
      unit - unit of returned angle.
      Returns:
      a new angle containing result.
    • add

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

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

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

      public void add(Angle a, Angle result)
      Adds provided angle and stores the result into provided angle.
      Parameters:
      a - angle to be added.
      result - instance where result will be stored.
    • subtract

      public static double subtract(double value1, AngleUnit unit1, double value2, AngleUnit unit2, AngleUnit resultUnit)
      Subtracts two angle 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, AngleUnit unit1, Number value2, AngleUnit unit2, AngleUnit resultUnit)
      Subtracts two angle 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(Angle arg1, Angle arg2, Angle result)
      Subtracts two angles and stores the result into provided instance.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      result - instance where result will be stored.
    • subtractAndReturnNew

      public static Angle subtractAndReturnNew(Angle arg1, Angle arg2, AngleUnit unit)
      Subtracts two angles.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      unit - unit of returned angle.
      Returns:
      a new angle containing result.
    • subtractAndReturnNew

      public Angle subtractAndReturnNew(double value, AngleUnit unit, AngleUnit resultUnit)
      Subtracts provided angle value and unit and returns a new angle instance using provided unit.
      Parameters:
      value - value to be subtracted.
      unit - unit of value to be subtracted.
      resultUnit - unit of returned angle.
      Returns:
      a new angle containing result.
    • subtractAndReturnNew

      public Angle subtractAndReturnNew(Number value, AngleUnit unit, AngleUnit resultUnit)
      Subtracts provided angle value and unit and returns a new angle instance using provided unit.
      Parameters:
      value - value to be subtracted.
      unit - unit of value to be subtracted.
      resultUnit - unit of returned angle.
      Returns:
      a new angle containing result.
    • subtractAndReturnNew

      public Angle subtractAndReturnNew(Angle a, AngleUnit unit)
      Subtracts provided angle to current instance and returns a new angle.
      Parameters:
      a - angle to be subtracted.
      unit - unit of returned angle.
      Returns:
      a new angle containing result.
    • subtract

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

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

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

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