Interface NumberHelper<N extends Number>

All Superinterfaces:
Comparator<Number>
All Known Implementing Classes:
BigDecimalHelper, BigIntegerHelper, DoubleHelper, FloatHelper, IntegerHelper, LongHelper, ShortHelper

public interface NumberHelper<N extends Number> extends Comparator<Number>
A generic interface on top of a specific Number implementation allowing to use it in a generalized fashion.
Author:
kimchy
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Number lhs, Number rhs)
    Adds the two numbers (can be of any Number type) and returns the type result that the number helper handles.
    Casts the give Number into the type the number helper handles.
    div(Number lhs, Number rhs)
    Divides the two numbers (can be of any Number type) and returns the type result that the number helper handles.
    Returns the maximum number for the specific type the number helper handles.
    Returns the minimum number for the specific type the number helper handles.
    mult(Number lhs, Number rhs)
    Multiplies the two numbers (can be of any Number type) and returns the type result that the number helper handles.
    ONE()
    Returns the "ONE" value for the given type.
    sub(Number lhs, Number rhs)
    Substracts the two numbers (can be of any Number type) and returns the type result that the number helper handles.
    Returns the "ZERO" value for the given type.
  • Method Details

    • cast

      N cast(Number n)
      Casts the give Number into the type the number helper handles.
    • MAX_VALUE

      N MAX_VALUE()
      Returns the maximum number for the specific type the number helper handles.
    • MIN_VALUE

      N MIN_VALUE()
      Returns the minimum number for the specific type the number helper handles.
    • ONE

      N ONE()
      Returns the "ONE" value for the given type.
    • ZERO

      N ZERO()
      Returns the "ZERO" value for the given type.
    • add

      N add(Number lhs, Number rhs)
      Adds the two numbers (can be of any Number type) and returns the type result that the number helper handles.
    • sub

      N sub(Number lhs, Number rhs)
      Substracts the two numbers (can be of any Number type) and returns the type result that the number helper handles.
    • mult

      N mult(Number lhs, Number rhs)
      Multiplies the two numbers (can be of any Number type) and returns the type result that the number helper handles.
    • div

      N div(Number lhs, Number rhs)
      Divides the two numbers (can be of any Number type) and returns the type result that the number helper handles.