Class LongField
- java.lang.Object
-
- com.singularsys.extensions.field.implementations.AbstractComparativeField
-
- com.singularsys.extensions.field.implementations.GenericField<E>
-
- com.singularsys.extensions.field.implementations.GenericPowerField<java.lang.Long>
-
- com.singularsys.extensions.field.implementations.LongField
-
- All Implemented Interfaces:
FieldI,IntegerConvertor,java.io.Serializable
public class LongField extends GenericPowerField<java.lang.Long>
A field where all operations are implemented using Long.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.extensions.field.implementations.GenericPowerField
one, zero
-
-
Constructor Summary
Constructors Constructor Description LongField()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.LongaddG(java.lang.Long l, java.lang.Long r)Adds two elements of type E.java.lang.Longcast(java.lang.Object l)Convert the input to type E.java.lang.IntegercmpG(java.lang.Long l, java.lang.Long r)Compare two objects of the same type.java.lang.LongconvertFromInt(java.lang.Integer l)Attempt to convert argument from an integerjava.lang.IntegerconvertToIntE(java.lang.Long l)If possible convert the argument to an Integer to enable integral powers.java.lang.LongdivG(java.lang.Long l, java.lang.Long r)Divides two elements of type E.java.lang.LonggetOne()Get the multiplicative identity for this field.java.lang.LonggetZero()Get the additive identity for this fieldjava.lang.LongmodG(java.lang.Long l, java.lang.Long r)Modulus of two elements of type E.java.lang.LongmulG(java.lang.Long l, java.lang.Long r)Multiplies two elements of type E.java.lang.LongnegG(java.lang.Long l)Negates an elements of type E.static longpower(long l, long r)java.lang.LongpowNonInt(java.lang.Long l, java.lang.Long r)Called when the power is not an integerjava.lang.LongsubG(java.lang.Long l, java.lang.Long r)Subtracts two elements of type E.-
Methods inherited from class com.singularsys.extensions.field.implementations.GenericPowerField
powG, powI
-
Methods inherited from class com.singularsys.extensions.field.implementations.GenericField
add, and, cmp, convertToInt, div, mod, mul, neg, not, or, pow, sub
-
-
-
-
Method Detail
-
addG
public java.lang.Long addG(java.lang.Long l, java.lang.Long r) throws EvaluationExceptionDescription copied from class:GenericFieldAdds two elements of type E.- Specified by:
addGin classGenericField<java.lang.Long>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the sum
- Throws:
EvaluationException- on error
-
cmpG
public java.lang.Integer cmpG(java.lang.Long l, java.lang.Long r) throws EvaluationExceptionDescription copied from class:GenericFieldCompare two objects of the same type.- Specified by:
cmpGin classGenericField<java.lang.Long>- Parameters:
l- left argumentr- right argument- Returns:
- -1, 0, 1 or null
- Throws:
EvaluationException
-
cast
public java.lang.Long cast(java.lang.Object l)
Description copied from class:GenericFieldConvert the input to type E.- Specified by:
castin classGenericField<java.lang.Long>- Returns:
- l cast to type E if possible or null if casting is not possible
-
divG
public java.lang.Long divG(java.lang.Long l, java.lang.Long r) throws EvaluationExceptionDescription copied from class:GenericFieldDivides two elements of type E.- Specified by:
divGin classGenericField<java.lang.Long>- Parameters:
l- numeratorr- denominator- Returns:
- the division
- Throws:
EvaluationException- on error
-
modG
public java.lang.Long modG(java.lang.Long l, java.lang.Long r) throws EvaluationExceptionDescription copied from class:GenericFieldModulus of two elements of type E.- Specified by:
modGin classGenericField<java.lang.Long>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the modulus
- Throws:
EvaluationException- on error
-
mulG
public java.lang.Long mulG(java.lang.Long l, java.lang.Long r) throws EvaluationExceptionDescription copied from class:GenericFieldMultiplies two elements of type E.- Specified by:
mulGin classGenericField<java.lang.Long>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the product
- Throws:
EvaluationException- on error
-
negG
public java.lang.Long negG(java.lang.Long l) throws EvaluationExceptionDescription copied from class:GenericFieldNegates an elements of type E.- Specified by:
negGin classGenericField<java.lang.Long>- Parameters:
l- the argument- Returns:
- the negation
- Throws:
EvaluationException- on error
-
powNonInt
public java.lang.Long powNonInt(java.lang.Long l, java.lang.Long r) throws EvaluationExceptionDescription copied from class:GenericPowerFieldCalled when the power is not an integer- Specified by:
powNonIntin classGenericPowerField<java.lang.Long>- Returns:
- Throws:
EvaluationException
-
subG
public java.lang.Long subG(java.lang.Long l, java.lang.Long r) throws EvaluationExceptionDescription copied from class:GenericFieldSubtracts two elements of type E.- Specified by:
subGin classGenericField<java.lang.Long>- Parameters:
l- lhs argumentr- rhs argument- Returns:
- the difference
- Throws:
EvaluationException- on error
-
power
public static long power(long l, long r)
-
convertToIntE
public java.lang.Integer convertToIntE(java.lang.Long 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.lang.Long>- Parameters:
l- argument to convert.- Returns:
- an integer or null if argument cannot be converted
- Throws:
EvaluationException
-
convertFromInt
public java.lang.Long 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.lang.Long>- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never
-
getOne
public java.lang.Long getOne()
Description copied from interface:FieldIGet the multiplicative identity for this field.- Specified by:
getOnein interfaceFieldI- Specified by:
getOnein classGenericField<java.lang.Long>- Returns:
- object representing one or null if undefined for this field
-
getZero
public java.lang.Long getZero()
Description copied from interface:FieldIGet the additive identity for this field- Specified by:
getZeroin interfaceFieldI- Specified by:
getZeroin classGenericField<java.lang.Long>- Returns:
- object representing zero or null if undefined for this field
-
-