MFFloat (3.14.0 310 API)
Date: 2018-05-30

com.marketfactory.api

## Class MFFloat

- java.lang.Object
- - com.marketfactory.api.MFFloat

- All Implemented Interfaces:
    java.lang.Comparable

      public class MFFloat
      extends java.lang.Object
      implements java.lang.Comparable

  A thin wrapper for a fixed-precision floating point number. This class is immutable, you may not change the contents of the object. (All operations on it create a new object.)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static MFFloat` | `NA` Special value: Not Applicable.
    `static MFFloat` | `NDA` Special value: No Data Available.
    `static MFFloat` | `NMA` Special value: No Market Available.
    `static MFFloat` | `ZERO` Special value: Zero (as a convenience).

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MFFloat()` Default constructor--creates a value with NA.
    `MFFloat(long value)` Constructor which accepts a raw long value (integer offset by 10^9).
    `MFFloat(java.lang.String svalue)` Constructor which accepts a string value.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MFFloat` | `add(MFFloat o)` Addition operator.
    `int` | `compareTo(java.lang.Object o)` Implements Comparable method compareTo.
    `boolean` | `equals(MFFloat o)` Comparison operator: equal.
    `int` | `fpart()`
    `boolean` | `gt(MFFloat o)` Comparison operator: greater-than.
    `boolean` | `gte(MFFloat o)` Comparison operator: greater-than or equal.
    `long` | `ipart()`
    `static boolean` | `isValid(MFFloat o)`
    `static long` | `longValueOf(java.lang.String s)`
    `boolean` | `lt(MFFloat o)` Comparison operator: less-than.
    `boolean` | `lte(MFFloat o)` Comparison operator: less-than or equal.
    `MFFloat` | `sub(MFFloat o)` Subtraction operator.
    `double` | `toDouble()`
    `long` | `toLong()`
    `java.lang.String` | `toString()` Convert the value to a human-readable string.
    `static MFFloat` | `valueOf(java.math.BigDecimal bd)`
    `static MFFloat` | `valueOf(double d, int precision)`
    `static MFFloat` | `valueOf(java.lang.String s)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### NMA

          public static MFFloat NMA

      Special value: No Market Available.

    - #### NDA

          public static MFFloat NDA

      Special value: No Data Available.

    - #### NA

          public static MFFloat NA

      Special value: Not Applicable.

    - #### ZERO

          public static MFFloat ZERO

      Special value: Zero (as a convenience).

  - ### Constructor Detail

    - #### MFFloat

          public MFFloat()

      Default constructor--creates a value with NA.

    - #### MFFloat

          public MFFloat(java.lang.String svalue)

      Constructor which accepts a string value.
      Parameters:
        `svalue` - -- the initial value

    - #### MFFloat

          public MFFloat(long value)

      Constructor which accepts a raw long value (integer offset by 10^9).
      Parameters:
        `value` - -- the initial value

  - ### Method Detail

    - #### longValueOf

          public static long longValueOf(java.lang.String s)
                                  throws java.lang.NumberFormatException

      Parameters:
        `s` - the stringized value
      Returns:
        a long value for the given string representation of a FP number. This will throw an exception is the format is invalid.
      Throws:
        `java.lang.NumberFormatException`

    - #### valueOf

          public static MFFloat valueOf(java.lang.String s)
                                 throws java.lang.NumberFormatException

      Parameters:
        `s` - the stringized float value
      Returns:
        a MFFloat object for the given string representation of a FP number.
      Throws:
        `java.lang.NumberFormatException`

    - #### valueOf

          public static MFFloat valueOf(double d,
                                        int precision)

      Parameters:
        `d` - -- double value
        `precision` - -- number of decimal places
      Returns:
        a MFFloat object for the given string representation of a FP number.

    - #### valueOf

          public static MFFloat valueOf(java.math.BigDecimal bd)

      Parameters:
        `bd` - value to be converted into an MFFloat
      Returns:
        a MFFloat object for the given string representation of a FP number.

    - #### toLong

          public long toLong()

      Returns:
        Provide access to the raw long value.

    - #### toDouble

          public double toDouble()

      Returns:
        Convert the value to a double. (Don't use this if you care about precision.)

    - #### ipart

          public long ipart()

      Returns:
        the integer portion of the numerical value.

    - #### fpart

          public int fpart()

      Returns:
        the fractional portion of the numerical value, as an integer which represents the number of billion'ths, without the sign.

    - #### toString

          public java.lang.String toString()

      Convert the value to a human-readable string.
      Overrides:
        `toString` in class `java.lang.Object`

    - #### equals

          public boolean equals(MFFloat o)

      Comparison operator: equal.
      Parameters:
        `o` - the rhs
      Returns:
        the test results

    - #### lte

          public boolean lte(MFFloat o)

      Comparison operator: less-than or equal.
      Parameters:
        `o` - the rhs
      Returns:
        the test results

    - #### gte

          public boolean gte(MFFloat o)

      Comparison operator: greater-than or equal.
      Parameters:
        `o` - the rhs
      Returns:
        the test results

    - #### lt

          public boolean lt(MFFloat o)

      Comparison operator: less-than.
      Parameters:
        `o` - the rhs
      Returns:
        the test results

    - #### gt

          public boolean gt(MFFloat o)

      Comparison operator: greater-than.
      Parameters:
        `o` - the rhs
      Returns:
        the test results

    - #### add

          public MFFloat add(MFFloat o)

      Addition operator. Will throw an exception if either of the objects is not valid.
      Parameters:
        `o` - is the addition amount
      Returns:
        the new value

    - #### sub

          public MFFloat sub(MFFloat o)
                      throws java.lang.UnsupportedOperationException

      Subtraction operator. Will throw an exception if either of the objects is not valid.
      Parameters:
        `o` - is the subtraction amount
      Returns:
        the new value
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### compareTo

          public int compareTo(java.lang.Object o)
                        throws java.lang.ClassCastException

      Implements Comparable method compareTo.
      Specified by:
        `compareTo` in interface `java.lang.Comparable`
      Throws:
        `java.lang.ClassCastException`

    - #### isValid

          public static boolean isValid(MFFloat o)

      Parameters:
        `o` - to check
      Returns:
        Check if MFFloat object has valid value.