MFFloat (3.14.0 400 API)
Date: 2018-11-22

com.marketfactory.zerogc.api

## Class MFFloat

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

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable

      public class MFFloat
      extends java.lang.Object
      implements java.lang.Comparable, java.io.Serializable

  A thin wrapper for a fixed-precision floating point number. This class is mutable to allow for zero garbage collection operation. All static operations and the toString operation will create new objects. So keep this in mind when writing zero gc code.
  See Also:
    Serialized Form

- - ### 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
    --- | ---
    `void` | `add(MFFloat o)` Addition operator.
    `int` | `compareTo(java.lang.Object o)` Implements Comparable method compareTo.
    `void` | `deepCopy(MFFloat src)` Copies state of MFFloat to this MFFloat
    `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)` Check if MFFloat object has valid value.
    `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.
    `void` | `setValue(long value)` Sets the value of the object through mutation.
    `void` | `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 stringized 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

    - #### deepCopy

          public void deepCopy(MFFloat src)

      Copies state of MFFloat to this MFFloat
      Parameters:
        `src` - -- the rhs float to be copied.
      Throws:
        `java.lang.IllegalStateException` - - when object is frozen.

    - #### setValue

          public void setValue(long value)

      Sets the value of the object through mutation. Used for zero gc operation.
      Parameters:
        `value` - -- the new value
      Throws:
        `java.lang.IllegalStateException` - - when object is frozen.

    - #### longValueOf

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

      Parameters:
        `s` - the string representation of a float
      Returns:
        a long value for the given string representation of a FP number.
      Throws:
        `java.lang.NumberFormatException` - if the format is invalid.

    - #### valueOf

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

      Parameters:
        `s` - the string representation of a float
      Returns:
        a MFFloat object for the given string representation of a FP number.
      Throws:
        `java.lang.NumberFormatException` - if the string cannot be converted.

    - #### valueOf

          public static MFFloat valueOf(double d,
                                        int precision)

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

    - #### valueOf

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

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

    - #### toLong

          public long toLong()

      Returns:
        the raw long value

    - #### toDouble

          public double toDouble()

      Returns:
        the value converted 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 float
      Returns:
        true if lhs float is equal to the rhs, else return false.

    - #### lte

          public boolean lte(MFFloat o)

      Comparison operator: less-than or equal.
      Parameters:
        `o` - -- the rhs float
      Returns:
        true if lhs float is less or equal, else return false.

    - #### gte

          public boolean gte(MFFloat o)

      Comparison operator: greater-than or equal.
      Parameters:
        `o` - -- the rhs float
      Returns:
        true if lhs float is greater or equal, else return false.

    - #### lt

          public boolean lt(MFFloat o)

      Comparison operator: less-than.
      Parameters:
        `o` - -- the rhs float
      Returns:
        true if lhs float is less, else return false.

    - #### gt

          public boolean gt(MFFloat o)

      Comparison operator: greater-than.
      Parameters:
        `o` - -- the rhs float
      Returns:
        true if lhs float is greater, else return false.

    - #### add

          public void add(MFFloat o)
                   throws java.lang.UnsupportedOperationException

      Addition operator. Will throw an exception if either of the objects is not valid.
      Parameters:
        `o` - -- the float to be subtracted
      Throws:
        `java.lang.UnsupportedOperationException` - if enay of the floats are invalid.

    - #### sub

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

      Subtraction operator.
      Parameters:
        `o` - -- the float to be subtracted
      Throws:
        `java.lang.UnsupportedOperationException` - if either of the objects is not valid.

    - #### 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)

      Check if MFFloat object has valid value.
      Parameters:
        `o` - the float to be checked
      Returns:
        the test results