Package com.singularsys.jep.bigdecimal
Class BigDecNumberFactory
java.lang.Object
com.singularsys.jep.bigdecimal.BigDecNumberFactory
- All Implemented Interfaces:
FixedPrecisionFunctionI,JepComponent,NumberFactory,Serializable
A NumberFactory producing BigDecimal objects.
- Since:
- Jep 4.1 supports fixed point numbers.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateNumber(boolean value) Create a number object with given boolean valuecreateNumber(double value) Creates a number object with given double value.createNumber(float value) Create a number object with given float valuecreateNumber(int value) Create a number object with given int valuecreateNumber(long value) Create a number object with given long valuecreateNumber(short value) Create a number object with given short valuecreateNumber(Complex value) Creates a number from a given complex value.createNumber(Number value) Creates a number object from a class implementing Number, May actually just return the class.createNumber(String value) Creates a number object and initializes its value.intGets the number of decimal places used.Gets a light-weight instance suitable for using in multiple threads.Return an object representing ZERO-ONE.getOne()Return an object representing ONE the multiplicative identity.getTwo()Return an object representing ONE+ONE.getZero()Return an object representing ZERO the additive identity.voidInitialize the component.voidsetDecimalPlaces(int scale) Sets the number of decimal places to use.void
-
Field Details
-
TWO
-
MINUSONE
-
mc
-
scale
protected int scale
-
-
Constructor Details
-
BigDecNumberFactory
Constructor- Parameters:
mc- MathContext to use
-
BigDecNumberFactory
-
-
Method Details
-
createNumber
Description copied from interface:NumberFactoryCreates a number object and initializes its value.- Specified by:
createNumberin interfaceNumberFactory- Parameters:
value- The initial value of the number as a string.
-
createNumber
Description copied from interface:NumberFactoryCreates a number object with given double value.- Specified by:
createNumberin interfaceNumberFactory
-
createNumber
Description copied from interface:NumberFactoryCreate a number object with given int value- Specified by:
createNumberin interfaceNumberFactory
-
createNumber
Description copied from interface:NumberFactoryCreate a number object with given short value- Specified by:
createNumberin interfaceNumberFactory
-
createNumber
Description copied from interface:NumberFactoryCreate a number object with given long value- Specified by:
createNumberin interfaceNumberFactory
-
createNumber
Description copied from interface:NumberFactoryCreate a number object with given float value- Specified by:
createNumberin interfaceNumberFactory
-
createNumber
Description copied from interface:NumberFactoryCreate a number object with given boolean value- Specified by:
createNumberin interfaceNumberFactory
-
createNumber
Description copied from interface:NumberFactoryCreates a number object from a class implementing Number, May actually just return the class.- Specified by:
createNumberin interfaceNumberFactory
-
createNumber
Description copied from interface:NumberFactoryCreates a number from a given complex value.- Specified by:
createNumberin interfaceNumberFactory
-
getMinusOne
Description copied from interface:NumberFactoryReturn an object representing ZERO-ONE.- Specified by:
getMinusOnein interfaceNumberFactory
-
getZero
Description copied from interface:NumberFactoryReturn an object representing ZERO the additive identity.- Specified by:
getZeroin interfaceNumberFactory
-
getOne
Description copied from interface:NumberFactoryReturn an object representing ONE the multiplicative identity.- Specified by:
getOnein interfaceNumberFactory
-
getTwo
Description copied from interface:NumberFactoryReturn an object representing ONE+ONE.- Specified by:
getTwoin interfaceNumberFactory
-
init
Description copied from interface:JepComponentInitialize 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:
initin interfaceJepComponent- Parameters:
jep- the current Jep instance
-
getMathContext
-
setMathContext
-
getLightWeightInstance
Description copied from interface:JepComponentGets a light-weight instance suitable for using in multiple threads.- Specified by:
getLightWeightInstancein interfaceJepComponent- Returns:
- either a new instance, null or 'this'.
-
setDecimalPlaces
public void setDecimalPlaces(int scale) Description copied from interface:FixedPrecisionFunctionISets the number of decimal places to use.- Specified by:
setDecimalPlacesin interfaceFixedPrecisionFunctionI- Parameters:
scale- either zero, a positive number or -1 for floating-point formats
-
getDecimalPlaces
public int getDecimalPlaces()Description copied from interface:FixedPrecisionFunctionIGets the number of decimal places used.- Specified by:
getDecimalPlacesin interfaceFixedPrecisionFunctionI- Returns:
- either zero, a positive number or -1 for floating-point formats
-