Class ModulusField
java.lang.Object
com.singularsys.extensions.field.AbstractComparativeField
com.singularsys.extensions.field.implementations.GenericField<Integer>
com.singularsys.extensions.field.implementations.ModulusField
- All Implemented Interfaces:
FieldI,IntegerConvertor,Serializable
A field to work with small modulus values < 46341.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds two elements of type E.Convert input to an integer in the range[0,modulus)Not implemented for this field.Attempt to convert argument from an integerIf possible convert the argument to an Integer to enable integral powers.Not implemented for this field.EqualsNot implemented for this field.getOne()Get the multiplicative identity for this field.getZero()Get the additive identity for this fieldNot implemented for this field.Not implemented for this field.Not implemented for this field.Modulus of two elements of type E.Multiplies two elements of type E.Not EqualsNegates an elements of type E.Raises l to the power of rSubtracts two elements of type E.
-
Constructor Details
-
ModulusField
public ModulusField(int modulus)
-
-
Method Details
-
cast
Convert input to an integer in the range[0,modulus)- Specified by:
castin classGenericField<Integer>- Parameters:
l- input- Returns:
- value in range or null if it cannot be converted
-
addG
Description copied from class:GenericFieldAdds two elements of type E.- Specified by:
addGin classGenericField<Integer>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the sum
-
subG
Description copied from class:GenericFieldSubtracts two elements of type E.- Specified by:
subGin classGenericField<Integer>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the difference
-
negG
Description copied from class:GenericFieldNegates an elements of type E.- Specified by:
negGin classGenericField<Integer>- Parameters:
l- the argument- Returns:
- the negation
-
mulG
Description copied from class:GenericFieldMultiplies two elements of type E.- Specified by:
mulGin classGenericField<Integer>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the product
-
divG
Not implemented for this field.- Specified by:
divGin classGenericField<Integer>- Parameters:
l- numeratorr- denominator- Returns:
- the division
-
modG
Description copied from class:GenericFieldModulus of two elements of type E.- Specified by:
modGin classGenericField<Integer>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the modulus
-
powG
Description copied from class:GenericFieldRaises l to the power of r- Specified by:
powGin classGenericField<Integer>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the power
-
cmpG
Not implemented for this field.- Specified by:
cmpGin classGenericField<Integer>- Parameters:
l- left argumentr- right argument- Returns:
- -1, 0, 1 or null
-
eq
Description 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.
-
ne
Description 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.
-
gt
Not 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.
-
ge
Not 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.
-
lt
Not 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.
-
le
Not 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.
-
getOne
Description copied from interface:FieldIGet the multiplicative identity for this field.- Specified by:
getOnein interfaceFieldI- Specified by:
getOnein classGenericField<Integer>- 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<Integer>- Returns:
- object representing zero or null if undefined for this field
-
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<Integer>- Parameters:
l- argument to convert.- Returns:
- an integer or null if argument cannot be converted
-
convertFromInt
Description copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Specified by:
convertFromIntin classGenericField<Integer>- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
-