Class DoubleField
- java.lang.Object
-
- com.singularsys.extensions.field.implementations.DoubleField
-
- All Implemented Interfaces:
FieldI,IntegerConvertor,java.io.Serializable
public final class DoubleField extends java.lang.Object implements FieldI, IntegerConvertor
A double field where all input must be double and all output is double.- Author:
- Richard Morris
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DoubleField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Doubleadd(java.lang.Object l, java.lang.Object r)Add two members of the field.java.lang.Booleanand(java.lang.Object l, java.lang.Object r)Logical and.java.lang.ObjectconvertFromInt(java.lang.Integer l)Attempt to convert argument from an integerjava.lang.IntegerconvertToInt(java.lang.Object l)Attempt to convert argument to an integerjava.lang.Doublediv(java.lang.Object l, java.lang.Object r)Divides two members of the field.java.lang.Booleaneq(java.lang.Object l, java.lang.Object r)Equalsjava.lang.Booleange(java.lang.Object l, java.lang.Object r)Greater or equal tojava.lang.ObjectgetOne()Get the multiplicative identity for this field.java.lang.ObjectgetZero()Get the additive identity for this fieldjava.lang.Booleangt(java.lang.Object l, java.lang.Object r)Greater thanjava.lang.Booleanle(java.lang.Object l, java.lang.Object r)Less than or equals tojava.lang.Booleanlt(java.lang.Object l, java.lang.Object r)Less thanjava.lang.Doublemod(java.lang.Object l, java.lang.Object r)The modulus of two members of the field.java.lang.Doublemul(java.lang.Object l, java.lang.Object r)Multiplies two members of the field.java.lang.Booleanne(java.lang.Object l, java.lang.Object r)Not Equalsjava.lang.Doubleneg(java.lang.Object l)The negation -x of an element.java.lang.Booleannot(java.lang.Object l)Logical not.java.lang.Booleanor(java.lang.Object l, java.lang.Object r)Logical or.java.lang.Doublepow(java.lang.Object l, java.lang.Object r)If l>=0 calls Math.pow, if l<0 (i.e. when the result would be complex) return null.java.lang.DoublepowG(java.lang.Double l, java.lang.Double r)java.lang.Doublesub(java.lang.Object l, java.lang.Object r)Subtract two members of the field.
-
-
-
Method Detail
-
add
public java.lang.Double add(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldIAdd two members of the field.- Specified by:
addin interfaceFieldI- 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
-
sub
public java.lang.Double sub(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldISubtract two members of the field.- Specified by:
subin interfaceFieldI- 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
-
neg
public java.lang.Double neg(java.lang.Object l) throws EvaluationExceptionDescription copied from interface:FieldIThe negation -x of an element.- Specified by:
negin interfaceFieldI- Parameters:
l- the argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
mul
public java.lang.Double mul(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldIMultiplies two members of the field.- Specified by:
mulin interfaceFieldI- 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
-
div
public java.lang.Double div(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldIDivides two members of the field.- Specified by:
divin interfaceFieldI- 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
-
mod
public java.lang.Double mod(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldIThe modulus of two members of the field.- Specified by:
modin interfaceFieldI- 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
-
pow
public java.lang.Double pow(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionIf l>=0 calls Math.pow, if l<0 (i.e. when the result would be complex) return null. Integral exponents are handled by the powI method.- Specified by:
powin interfaceFieldI- 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
-
powG
public java.lang.Double powG(java.lang.Double l, java.lang.Double r)
-
eq
public java.lang.Boolean eq(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldIEquals- Specified by:
eqin interfaceFieldI- 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
-
ne
public java.lang.Boolean ne(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldINot Equals- Specified by:
nein interfaceFieldI- 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
-
gt
public java.lang.Boolean gt(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldIGreater than- Specified by:
gtin interfaceFieldI- 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 EvaluationExceptionDescription copied from interface:FieldIGreater or equal to- Specified by:
gein interfaceFieldI- 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 EvaluationExceptionDescription copied from interface:FieldILess than- Specified by:
ltin interfaceFieldI- 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 EvaluationExceptionDescription copied from interface:FieldILess than or equals to- Specified by:
lein interfaceFieldI- 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
-
and
public java.lang.Boolean and(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldILogical and.- Specified by:
andin interfaceFieldI- Parameters:
l- left hand argument implimentationr- right hand argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
or
public java.lang.Boolean or(java.lang.Object l, java.lang.Object r) throws EvaluationExceptionDescription copied from interface:FieldILogical or.- Specified by:
orin interfaceFieldI- 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
-
not
public java.lang.Boolean not(java.lang.Object l) throws EvaluationExceptionDescription copied from interface:FieldILogical not.- Specified by:
notin interfaceFieldI- Parameters:
l- argument- Returns:
- an object representing the result or null if it can not be evaluated.
- Throws:
EvaluationException- on error
-
getOne
public java.lang.Object getOne()
Description copied from interface:FieldIGet the multiplicative identity for this field.
-
getZero
public java.lang.Object getZero()
Description copied from interface:FieldIGet the additive identity for this field
-
convertToInt
public java.lang.Integer convertToInt(java.lang.Object l)
Description copied from interface:IntegerConvertorAttempt to convert argument to an integer- Specified by:
convertToIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding integer or null if it cannot be converted
-
convertFromInt
public java.lang.Object convertFromInt(java.lang.Integer l) throws EvaluationExceptionDescription copied from interface:IntegerConvertorAttempt to convert argument from an integer- Specified by:
convertFromIntin interfaceIntegerConvertor- Parameters:
l- value to convert- Returns:
- corresponding value in this field or null if it cannot be converted
- Throws:
EvaluationException- probably never
-
-