Package com.singularsys.jep.bigdecimal

# Class BigDecNumberFactory

java.lang.Object
com.singularsys.jep.bigdecimal.BigDecNumberFactory

All Implemented Interfaces:
  `FixedPrecisionFunctionI`, `JepComponent`, `NumberFactory`, `Serializable`

public class BigDecNumberFactory extends Object implements NumberFactory, FixedPrecisionFunctionI
A NumberFactory producing BigDecimal objects.

Since:
  Jep 4.1 supports fixed point numbers.
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected MathContext`
  `mc`
  `BigDecimal`
  `MINUSONE`
  `protected int`
  `scale`
  `BigDecimal`
  `TWO`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BigDecNumberFactory(MathContext mc)`
  Constructor
  `BigDecNumberFactory(MathContext mc, int scale)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `createNumber(boolean value)`
  Create a number object with given boolean value
  `Object`
  `createNumber(double value)`
  Creates a number object with given double value.
  `Object`
  `createNumber(float value)`
  Create a number object with given float value
  `Object`
  `createNumber(int value)`
  Create a number object with given int value
  `Object`
  `createNumber(long value)`
  Create a number object with given long value
  `Object`
  `createNumber(short value)`
  Create a number object with given short value
  `Object`
  `createNumber(Complex value)`
  Creates a number from a given complex value.
  `Object`
  `createNumber(Number value)`
  Creates a number object from a class implementing Number, May actually just return the class.
  `Object`
  `createNumber(String value)`
  Creates a number object and initializes its value.
  `int`
  `getDecimalPlaces()`
  Gets the number of decimal places used.
  `JepComponent`
  `getLightWeightInstance()`
  Gets a light-weight instance suitable for using in multiple threads.
  `MathContext`
  `getMathContext()`
  `Object`
  `getMinusOne()`
  Return an object representing ZERO-ONE.
  `Object`
  `getOne()`
  Return an object representing ONE the multiplicative identity.
  `Object`
  `getTwo()`
  Return an object representing ONE+ONE.
  `Object`
  `getZero()`
  Return an object representing ZERO the additive identity.
  `void`
  `init(Jep jep)`
  Initialize the component.
  `void`
  `setDecimalPlaces(int scale)`
  Sets the number of decimal places to use.
  `void`
  `setMathContext(MathContext mc)`

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

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

- ## Field Details

  - ### TWO

    public BigDecimal TWO

  - ### MINUSONE

    public BigDecimal MINUSONE

  - ### mc

    protected MathContext mc

  - ### scale

    protected int scale

- ## Constructor Details

  - ### BigDecNumberFactory

    public BigDecNumberFactory(MathContext mc)
    Constructor
    Parameters:
      `mc` - MathContext to use

  - ### BigDecNumberFactory

    public BigDecNumberFactory(MathContext mc, int scale)

- ## Method Details

  - ### createNumber

    public Object createNumber(String value)
    Description copied from interface: `NumberFactory`
    Creates a number object and initializes its value.
    Specified by:
      `createNumber` in interface `NumberFactory`
    Parameters:
      `value` - The initial value of the number as a string.

  - ### createNumber

    public Object createNumber(double value)
    Description copied from interface: `NumberFactory`
    Creates a number object with given double value.
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### createNumber

    public Object createNumber(int value)
    Description copied from interface: `NumberFactory`
    Create a number object with given int value
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### createNumber

    public Object createNumber(short value)
    Description copied from interface: `NumberFactory`
    Create a number object with given short value
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### createNumber

    public Object createNumber(long value)
    Description copied from interface: `NumberFactory`
    Create a number object with given long value
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### createNumber

    public Object createNumber(float value)
    Description copied from interface: `NumberFactory`
    Create a number object with given float value
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### createNumber

    public Object createNumber(boolean value)
    Description copied from interface: `NumberFactory`
    Create a number object with given boolean value
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### createNumber

    public Object createNumber(Number value)
    Description copied from interface: `NumberFactory`
    Creates a number object from a class implementing Number, May actually just return the class.
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### createNumber

    public Object createNumber(Complex value)
    Description copied from interface: `NumberFactory`
    Creates a number from a given complex value.
    Specified by:
      `createNumber` in interface `NumberFactory`

  - ### getMinusOne

    public Object getMinusOne()
    Description copied from interface: `NumberFactory`
    Return an object representing ZERO-ONE.
    Specified by:
      `getMinusOne` in interface `NumberFactory`

  - ### getZero

    public Object getZero()
    Description copied from interface: `NumberFactory`
    Return an object representing ZERO the additive identity.
    Specified by:
      `getZero` in interface `NumberFactory`

  - ### getOne

    public Object getOne()
    Description copied from interface: `NumberFactory`
    Return an object representing ONE the multiplicative identity.
    Specified by:
      `getOne` in interface `NumberFactory`

  - ### getTwo

    public Object getTwo()
    Description copied from interface: `NumberFactory`
    Return an object representing ONE+ONE.
    Specified by:
      `getTwo` in interface `NumberFactory`

  - ### init

    public void init(Jep jep)
    Description copied from interface: `JepComponent`
    Initialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.
    Specified by:
      `init` in interface `JepComponent`
    Parameters:
      `jep` - the current Jep instance

  - ### getMathContext

    public MathContext getMathContext()

  - ### setMathContext

    public void setMathContext(MathContext mc)

  - ### getLightWeightInstance

    public JepComponent getLightWeightInstance()
    Description copied from interface: `JepComponent`
    Gets a light-weight instance suitable for using in multiple threads.
    Specified by:
      `getLightWeightInstance` in interface `JepComponent`
    Returns:
      either a new instance, null or 'this'.

  - ### setDecimalPlaces

    public void setDecimalPlaces(int scale)
    Description copied from interface: `FixedPrecisionFunctionI`
    Sets the number of decimal places to use.
    Specified by:
      `setDecimalPlaces` in interface `FixedPrecisionFunctionI`
    Parameters:
      `scale` - either zero, a positive number or -1 for floating-point formats

  - ### getDecimalPlaces

    public int getDecimalPlaces()
    Description copied from interface: `FixedPrecisionFunctionI`
    Gets the number of decimal places used.
    Specified by:
      `getDecimalPlaces` in interface `FixedPrecisionFunctionI`
    Returns:
      either zero, a positive number or -1 for floating-point formats