Class BasicCalculator

java.lang.Object
ch.nolix.base.math.basic.BasicCalculator
All Implemented Interfaces:
IBasicCalculator

public final class BasicCalculator extends Object implements IBasicCalculator
Author:
Silvan Wyss
  • Constructor Details

    • BasicCalculator

      public BasicCalculator()
  • Method Details

    • getAbsoluteDifference

      public double getAbsoluteDifference(double value1, double value2)
      Specified by:
      getAbsoluteDifference in interface IBasicCalculator
      Parameters:
      value1 -
      value2 -
      Returns:
      the absolute difference between the given 2 values.
    • getAbsoluteDifference

      public int getAbsoluteDifference(int value1, int value2)
      Specified by:
      getAbsoluteDifference in interface IBasicCalculator
      Parameters:
      value1 -
      value2 -
      Returns:
      the absolute difference between the given 2 values.
    • getAbsoluteDifference

      public long getAbsoluteDifference(long value1, long value2)
      Specified by:
      getAbsoluteDifference in interface IBasicCalculator
      Parameters:
      value1 -
      value2 -
      Returns:
      the absolute difference between the given 2 values.
    • getAbsoluteValue

      public double getAbsoluteValue(double value)
      The absolute value of a value x is -x if x is negative, x otherwise.
      Specified by:
      getAbsoluteValue in interface IBasicCalculator
      Parameters:
      value -
      Returns:
      the absolute value of the given value.
    • getAbsoluteValue

      public int getAbsoluteValue(int value)
      The absolute value of a value x is -x if x is negative, x otherwise.
      Specified by:
      getAbsoluteValue in interface IBasicCalculator
      Parameters:
      value -
      Returns:
      the absolute value of the given value.
    • getAbsoluteValue

      public long getAbsoluteValue(long value)
      The absolute value of a value x is -x if x is negative, x otherwise.
      Specified by:
      getAbsoluteValue in interface IBasicCalculator
      Parameters:
      value -
      Returns:
      the absolute value of the given value.
    • getAverage

      public double getAverage(double... values)
      Specified by:
      getAverage in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the average of the given values.
    • getAverage

      public double getAverage(Iterable<Double> values)
      Specified by:
      getAverage in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the average of the given values.
    • getAverage

      public int getAverage(int... values)
      Specified by:
      getAverage in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the average of the given values.
    • getAverage

      public long getAverage(long... values)
      Specified by:
      getAverage in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the average of the given values.
    • getMax

      public double getMax(double... values)
      Specified by:
      getMax in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the biggest value of the given values.
    • getMax

      public int getMax(int... values)
      Specified by:
      getMax in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the biggest value of the given values.
    • getMax

      public long getMax(long... values)
      Specified by:
      getMax in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the biggest value of the given values.
    • getMin

      public double getMin(double... values)
      Specified by:
      getMin in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the smallest value of the given values.
    • getMin

      public int getMin(int... values)
      Specified by:
      getMin in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the smallest value of the given values.
    • getMin

      public long getMin(long... values)
      Specified by:
      getMin in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the smallest value of the given values.
    • getSquare

      public double getSquare(double value)
      Specified by:
      getSquare in interface IBasicCalculator
      Parameters:
      value -
      Returns:
      the square of the given value.
    • getSquare

      public double getSquare(int value)
      Specified by:
      getSquare in interface IBasicCalculator
      Parameters:
      value -
      Returns:
      the square of the given value.
    • getSquare

      public double getSquare(long value)
      Specified by:
      getSquare in interface IBasicCalculator
      Parameters:
      value -
      Returns:
      the square of the given value.
    • getSum

      public double getSum(double... values)
      Specified by:
      getSum in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the sum of the given values.
    • getSum

      public int getSum(int... values)
      Specified by:
      getSum in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the sum of the given values.
    • getSum

      public double getSum(Iterable<Double> values)
      Specified by:
      getSum in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the sum of the given values.
    • getSum

      public long getSum(long... values)
      Specified by:
      getSum in interface IBasicCalculator
      Parameters:
      values -
      Returns:
      the sum of the given values.