Interface FloatingPointType<T extends java.lang.Number & java.lang.Comparable<T>>

  • Type Parameters:
    T - kind of elements
    All Known Implementing Classes:
    IEEEDoubleType, IEEEFloatType

    public interface FloatingPointType<T extends java.lang.Number & java.lang.Comparable<T>>

    Title: Floating Point Type

    Description: Interface to provide a common set of methods for Float and Double types

    Copyright: Copyright (c) 2009

    Company: Clark & Parsia, LLC.

    Author:
    Mike Smith
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T cast​(java.lang.Object o)
      Casts an object to the class described by this FloatingPointType object.
      T decrement​(T n)  
      T getNaN()
      Gets the Not-a-Number constant for the type.
      T getNegativeInfinity()
      Gets the negative infinity constant for the type.
      T getPositiveInfinity()
      Gets the positive infinity constant for the type.
      T increment​(T n)  
      java.lang.Number intervalSize​(T lower, T upper)
      Count the number of floating point values in an inclusive interval
      boolean isInstance​(java.lang.Object o)
      Determine if the specified Object is assignment compatible with the object represented by this FloatingPointType.
      boolean isNaN​(T f)
      Returns true if this floating point value is a Not-a-Number (NaN) value, false otherwise.
    • Method Detail

      • cast

        T cast​(java.lang.Object o)
        Casts an object to the class described by this FloatingPointType object.
        Parameters:
        o - the object to cast
        Returns:
        o in the appropriate type
        Throws:
        java.lang.ClassCastException - if the object is not null and is no assignable to the type T.
      • decrement

        T decrement​(T n)
        Parameters:
        n - The value to decrement Return the next floating point value in the direction of -Inf.
        Returns:
        If n > -Inf, the next floating point value in the direction of -Inf. If n == -Inf, -Inf.
        Throws:
        java.lang.IllegalArgumentException - if n.isNaN()
      • getNaN

        T getNaN()
        Gets the Not-a-Number constant for the type.
        Returns:
        T.NaN
      • getNegativeInfinity

        T getNegativeInfinity()
        Gets the negative infinity constant for the type.
        Returns:
        T.NEGATIVE_INFINITY
      • getPositiveInfinity

        T getPositiveInfinity()
        Gets the positive infinity constant for the type.
        Returns:
        T.POSITIVE_INFINITY
      • increment

        T increment​(T n)
        Parameters:
        n - The value to increment Return the next floating point value in the direction of +Inf.
        Returns:
        If n < +Inf, the next floating point value in the direction of +Inf. If n == +Inf, +Inf.
        Throws:
        java.lang.IllegalArgumentException - if n.isNaN()
      • intervalSize

        java.lang.Number intervalSize​(T lower,
                                      T upper)
        Count the number of floating point values in an inclusive interval
        Parameters:
        lower - The lower bound of the interval
        upper - The upper bound of the interval
        Returns:
        If lower.equals(upper), 1. Else, the number of floating point values between lower and upper plus 2
      • isInstance

        boolean isInstance​(java.lang.Object o)
        Determine if the specified Object is assignment compatible with the object represented by this FloatingPointType. Typically implemented as a wrapper for T.class.isInstance(Object).
        Parameters:
        o - the object to check
        Returns:
        true if o is an instance of T, false else.
      • isNaN

        boolean isNaN​(T f)
        Returns true if this floating point value is a Not-a-Number (NaN) value, false otherwise.
        Parameters:
        f - the value to be tested
        Returns:
        true if the argument is NaN, else false