Module math

Interface Arithmetic<N extends Number>

Type Parameters:
N - Number type
All Superinterfaces:
Comparable<N>
All Known Implementing Classes:
RationalNumber

public interface Arithmetic<N extends Number> extends Comparable<N>
An interface to define requirements for a number to perform arithmetic operations. The Numbers are supposed to remain unchanged by an arithmetic operation.
Author:
Arthur Zimek
  • Method Summary

    Modifier and Type
    Method
    Description
    divided(N number)
    Divides this number by the given number.
    minus(N number)
    Subtracts the given number from this number.
    plus(N number)
    Adds the given number to this number.
    times(N number)
    Multiplies this number with the given number.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • plus

      N plus(N number)
      Adds the given number to this number.
      Parameters:
      number - the number to add to this number.
      Returns:
      the result of arithmetic addition of this Number with the given number
    • times

      N times(N number)
      Multiplies this number with the given number.
      Parameters:
      number - the number to multiply this number with
      Returns:
      the result of arithmetic multiplication of this Number with the given number
    • minus

      N minus(N number)
      Subtracts the given number from this number.
      Parameters:
      number - the number to subtract from this number
      Returns:
      the result of arithmetic subtraction of the given number from this Number
    • divided

      N divided(N number)
      Divides this number by the given number.
      Parameters:
      number - the number to divide this number by
      Returns:
      the result of arithmetic division of this Number by the given number