Class Surface

All Implemented Interfaces:
Serializable

public class Surface extends Measurement<SurfaceUnit>
Contains a surface value and unit.
See Also:
  • Constructor Details

    • Surface

      public Surface(Number value, SurfaceUnit unit)
      Constructor with value and units.
      Parameters:
      value - surface value.
      unit - unit of surface.
      Throws:
      IllegalArgumentException - if either value or unit is null.
    • Surface

      Surface()
      Constructor.
  • Method Details

    • equals

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

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

      public static Surface addAndReturnNew(Surface arg1, Surface arg2, SurfaceUnit unit)
      Adds two surfaces.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      unit - unit of returned surface.
      Returns:
      a new instance containing result.
    • addAndReturnNew

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

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

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

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

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

      public void add(Surface surface)
      Adds provided surface and updates current distance.
      Parameters:
      surface - surface to be added.
    • add

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

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

      public static Surface subtractAndReturnNew(Surface arg1, Surface arg2, SurfaceUnit unit)
      Subtracts two surfaces.
      Parameters:
      arg1 - 1st argument.
      arg2 - 2nd argument.
      unit - unit of returned surface.
      Returns:
      a new instance containing result.
    • subtractAndReturnNew

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

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

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

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

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

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

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