Class BigDecimalField
java.lang.Object
com.singularsys.extensions.field.AbstractComparativeField
com.singularsys.extensions.field.implementations.GenericField<BigDecimal>
com.singularsys.extensions.field.implementations.BigDecimalField
- All Implemented Interfaces:
FieldI,IntegerConvertor,Serializable
Implementation of field methods using BigDecimals
- Author:
- Richard Morris
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddG(BigDecimal l, BigDecimal r) Adds two elements of type E.Convert the input to type E.cmpG(BigDecimal l, BigDecimal r) Compare two objects of the same type.Attempt to convert argument from an integerIf possible convert the argument to an Integer to enable integral powers.divG(BigDecimal l, BigDecimal r) Divides two elements of type E.getOne()Get the multiplicative identity for this field.getZero()Get the additive identity for this fieldmodG(BigDecimal l, BigDecimal r) Modulus of two elements of type E.mulG(BigDecimal l, BigDecimal r) Multiplies two elements of type E.negG(BigDecimal l) Negates an elements of type E.powG(BigDecimal l, BigDecimal r) Only integral values are allowed.subG(BigDecimal l, BigDecimal r) Subtracts two elements of type E.Methods inherited from class com.singularsys.extensions.field.implementations.GenericField
add, and, cmp, convertToInt, div, mod, mul, neg, not, or, pow, sub
-
Constructor Details
-
BigDecimalField
- Parameters:
mc-
-
-
Method Details
-
cast
Description copied from class:GenericFieldConvert the input to type E.- Specified by:
castin classGenericField<BigDecimal>- Parameters:
l-- Returns:
- l if l is a BigDecimal, null otherwise
-
addG
Description copied from class:GenericFieldAdds two elements of type E.- Specified by:
addGin classGenericField<BigDecimal>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the sum
- Throws:
EvaluationException- on error
-
subG
Description copied from class:GenericFieldSubtracts two elements of type E.- Specified by:
subGin classGenericField<BigDecimal>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the difference
- Throws:
EvaluationException- on error
-
negG
Description copied from class:GenericFieldNegates an elements of type E.- Specified by:
negGin classGenericField<BigDecimal>- Parameters:
l- the argument- Returns:
- the negation
-
mulG
Description copied from class:GenericFieldMultiplies two elements of type E.- Specified by:
mulGin classGenericField<BigDecimal>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the product
- Throws:
EvaluationException- on error
-
divG
Description copied from class:GenericFieldDivides two elements of type E.- Specified by:
divGin classGenericField<BigDecimal>- Parameters:
l- numeratorr- denominator- Returns:
- the division
- Throws:
EvaluationException- on error
-
modG
Description copied from class:GenericFieldModulus of two elements of type E.- Specified by:
modGin classGenericField<BigDecimal>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the modulus
-
powG
Only integral values are allowed.- Specified by:
powGin classGenericField<BigDecimal>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the power
- Throws:
EvaluationException- for non integral values.
-
cmpG
Description copied from class:GenericFieldCompare two objects of the same type.- Specified by:
cmpGin classGenericField<BigDecimal>- Parameters:
l- left argumentr- right argument- Returns:
- -1, 0, 1 or null
-
getOne
Description copied from interface:FieldIGet the multiplicative identity for this field.- Specified by:
getOnein interfaceFieldI- Specified by:
getOnein classGenericField<BigDecimal>- Returns:
- object representing one or null if undefined for this field
-
getZero
Description copied from interface:FieldIGet the additive identity for this field- Specified by:
getZeroin interfaceFieldI- Specified by:
getZeroin classGenericField<BigDecimal>- Returns:
- object representing zero or null if undefined for this field
-
convertFromInt
Description copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Specified by:
convertFromIntin classGenericField<BigDecimal>- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
-
convertToIntE
Description copied from class:GenericFieldIf possible convert the argument to an Integer to enable integral powers. If the argument cannot be converted null should be returned and thepowG(E,E)method will be called.- Specified by:
convertToIntEin classGenericField<BigDecimal>- Parameters:
l- argument to convert.- Returns:
- an integer or null if argument cannot be converted
-