Class BigModulusField
- java.lang.Object
-
- com.singularsys.extensions.field.implementations.AbstractComparativeField
-
- com.singularsys.extensions.field.implementations.GenericField<java.math.BigInteger>
-
- com.singularsys.extensions.field.implementations.BigModulusField
-
- All Implemented Interfaces:
FieldI,IntegerConvertor,java.io.Serializable
public class BigModulusField extends GenericField<java.math.BigInteger>
A field to work with modulus values of any value, used BigInteger.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BigModulusField(java.math.BigInteger modulus)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigIntegeraddG(java.math.BigInteger l, java.math.BigInteger r)Adds two elements of type E.java.math.BigIntegercast(java.lang.Object l)Convert the input to type E.java.lang.IntegercmpG(java.math.BigInteger l, java.math.BigInteger r)Not implemented for this field.java.math.BigIntegerconvertFromInt(java.lang.Integer l)Attempt to convert argument from an integerjava.lang.IntegerconvertToIntE(java.math.BigInteger l)If possible convert the argument to an Integer to enable integral powers.java.math.BigIntegerdivG(java.math.BigInteger l, java.math.BigInteger r)Divides two elements of type E.java.lang.Booleaneq(java.lang.Object lo, java.lang.Object ro)Equalsjava.lang.Booleange(java.lang.Object l, java.lang.Object r)Not implemented for this field.java.math.BigIntegergetOne()Get the multiplicative identity for this field.java.math.BigIntegergetZero()Get the additive identity for this fieldjava.lang.Booleangt(java.lang.Object l, java.lang.Object r)Not implemented for this field.java.lang.Booleanle(java.lang.Object l, java.lang.Object r)Not implemented for this field.java.lang.Booleanlt(java.lang.Object l, java.lang.Object r)Not implemented for this field.java.math.BigIntegermodG(java.math.BigInteger l, java.math.BigInteger r)Modulus of two elements of type E.java.math.BigIntegermulG(java.math.BigInteger l, java.math.BigInteger r)Multiplies two elements of type E.java.lang.Booleanne(java.lang.Object lo, java.lang.Object ro)Not Equalsjava.math.BigIntegernegG(java.math.BigInteger l)Negates an elements of type E.java.math.BigIntegerpowG(java.math.BigInteger l, java.math.BigInteger r)Raises l to the power of rjava.math.BigIntegersubG(java.math.BigInteger l, java.math.BigInteger r)Subtracts two elements of type E.
-
-
-
Method Detail
-
cast
public java.math.BigInteger cast(java.lang.Object l)
Description copied from class:GenericFieldConvert the input to type E.- Specified by:
castin classGenericField<java.math.BigInteger>- Returns:
- l if l is a BigInteger modulo the modulus, null otherwise
-
addG
public java.math.BigInteger addG(java.math.BigInteger l, java.math.BigInteger r) throws EvaluationExceptionDescription copied from class:GenericFieldAdds two elements of type E.- Specified by:
addGin classGenericField<java.math.BigInteger>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the sum
- Throws:
EvaluationException- on error
-
subG
public java.math.BigInteger subG(java.math.BigInteger l, java.math.BigInteger r) throws EvaluationExceptionDescription copied from class:GenericFieldSubtracts two elements of type E.- Specified by:
subGin classGenericField<java.math.BigInteger>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the difference
- Throws:
EvaluationException- on error
-
negG
public java.math.BigInteger negG(java.math.BigInteger l) throws EvaluationExceptionDescription copied from class:GenericFieldNegates an elements of type E.- Specified by:
negGin classGenericField<java.math.BigInteger>- Parameters:
l- the argument- Returns:
- the negation
- Throws:
EvaluationException- on error
-
mulG
public java.math.BigInteger mulG(java.math.BigInteger l, java.math.BigInteger r) throws EvaluationExceptionDescription copied from class:GenericFieldMultiplies two elements of type E.- Specified by:
mulGin classGenericField<java.math.BigInteger>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the product
- Throws:
EvaluationException- on error
-
divG
public java.math.BigInteger divG(java.math.BigInteger l, java.math.BigInteger r) throws EvaluationExceptionDescription copied from class:GenericFieldDivides two elements of type E.- Specified by:
divGin classGenericField<java.math.BigInteger>- Parameters:
l- numeratorr- denominator- Returns:
- the division
- Throws:
EvaluationException- on error
-
modG
public java.math.BigInteger modG(java.math.BigInteger l, java.math.BigInteger r) throws EvaluationExceptionDescription copied from class:GenericFieldModulus of two elements of type E.- Specified by:
modGin classGenericField<java.math.BigInteger>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the modulus
- Throws:
EvaluationException- on error
-
powG
public java.math.BigInteger powG(java.math.BigInteger l, java.math.BigInteger r) throws EvaluationExceptionDescription copied from class:GenericFieldRaises l to the power of r- Specified by:
powGin classGenericField<java.math.BigInteger>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the power
- Throws:
EvaluationException- on error
-
cmpG
public java.lang.Integer cmpG(java.math.BigInteger l, java.math.BigInteger r) throws EvaluationExceptionNot implemented for this field.- Specified by:
cmpGin classGenericField<java.math.BigInteger>- Parameters:
l- left argumentr- right argument- Returns:
- -1, 0, 1 or null
- Throws:
EvaluationException
-
eq
public java.lang.Boolean eq(java.lang.Object lo, java.lang.Object ro) throws EvaluationExceptionDescription copied from interface:FieldIEquals- Specified by:
eqin interfaceFieldI- Overrides:
eqin classAbstractComparativeField- Parameters:
lo- left hand argumentro- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
ne
public java.lang.Boolean ne(java.lang.Object lo, java.lang.Object ro) throws EvaluationExceptionDescription copied from interface:FieldINot Equals- Specified by:
nein interfaceFieldI- Overrides:
nein classAbstractComparativeField- Parameters:
lo- left hand argumentro- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
gt
public java.lang.Boolean gt(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionNot implemented for this field.- Specified by:
gtin interfaceFieldI- Overrides:
gtin classAbstractComparativeField- Parameters:
l- left hand argumentr- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
ge
public java.lang.Boolean ge(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionNot implemented for this field.- Specified by:
gein interfaceFieldI- Overrides:
gein classAbstractComparativeField- Parameters:
l- left hand argumentr- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
lt
public java.lang.Boolean lt(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionNot implemented for this field.- Specified by:
ltin interfaceFieldI- Overrides:
ltin classAbstractComparativeField- Parameters:
l- left hand argumentr- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
le
public java.lang.Boolean le(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionNot implemented for this field.- Specified by:
lein interfaceFieldI- Overrides:
lein classAbstractComparativeField- Parameters:
l- left hand argumentr- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
getOne
public java.math.BigInteger getOne()
Description copied from interface:FieldIGet the multiplicative identity for this field.- Specified by:
getOnein interfaceFieldI- Specified by:
getOnein classGenericField<java.math.BigInteger>- Returns:
- object representing one or null if undefined for this field
-
getZero
public java.math.BigInteger getZero()
Description copied from interface:FieldIGet the additive identity for this field- Specified by:
getZeroin interfaceFieldI- Specified by:
getZeroin classGenericField<java.math.BigInteger>- Returns:
- object representing zero or null if undefined for this field
-
convertToIntE
public java.lang.Integer convertToIntE(java.math.BigInteger l) throws EvaluationExceptionDescription 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<java.math.BigInteger>- Parameters:
l- argument to convert.- Returns:
- an integer or null if argument cannot be converted
- Throws:
EvaluationException
-
convertFromInt
public java.math.BigInteger convertFromInt(java.lang.Integer l) throws EvaluationExceptionDescription copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Specified by:
convertFromIntin classGenericField<java.math.BigInteger>- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never
-
-