Package com.singularsys.extensions.field.implementations
Standard FieldI implementations, and utility classes for construction implementations.
Basic types
Rational
- Unlimited precision rational numbers.
com.singularsys.jep.standard.Complex
- Complex numbers
Standard Implementations
DoubleField
-
Implemented using
Double
s. -
IntegerField
- Implemented using
Integer
s, -
ExactIntegerField
- Implemented using
Integer
s and the new addExact(int,int) etc. of java.lang.Math methods of Java 1.8. These throw ArithmeticException if results overflow. The Jep implementation wrap these exceptions in EvaluationExceptions. -
BigIntegerField
- Unlimited precision integers, implemented using
BigInteger
s -
BigDecimalField
- Implemented using
BigDecimal
s. Can be set to use a specific NumberContext to set the level of accuracy required. -
RationalField
- Rational numbers represented as a quotient of two
BigIntegers
, and implemented using theRational
data-type. -
ComplexField
- Complex numbers implemented using the Complex data type.
-
ModulusField
- Integers modulo a given base, i.e. Z(n). The modulus is specified in the constructor and can use with modulus upto 46,341.
-
BigModulusField
- Performs integer calculations modulus a value specified in the constructor. This class can use very large values of the modulus.
BooleanField
- Implements the standard logical operations. Generally used to add logical capabilities to other fields.
StringField
- Allows addition and comparison of strings.
NumberFactories
Classes which implement NumberFactory
used
to parse string representations of numbers.
IntegerNumberFactory
- Parse numeric string as
Integer
s. com.singularsys.jep.standard.DoubleNumberFactory
- Parse numeric string as
Double
s. IntDoubleNumberFactory
- Parse numeric strings as
Integer
s orDouble
s depending on the string. LongDoubleNumberFactory
- Parse numeric strings as
Long
s orDouble
s depending on the string. RationalNumberFactory
- Parse numeric string as
Rational
s. ComplexNumberFactory
- Parse numeric string as
Complex
s. BigIntegerNumberFactory
- Parse numeric string as
BigInteger
s. com.singularsys.jep.bigdecimal.BigDecNumberFactory
- Parse numeric string as
BigDecimals
s.
Decorators
Classes which perform type conversion. These extend the abstract base class
FieldDecorator
.
NumberToDoubleDecorator
- Converts all number types to Doubles. A flag can be set so that on output Doubles can be converted to Integers when there is no loss of precision.
NumberToComplexDecorator
- Converts all number types to Complex. A flag can be set so that if the complex number represents a real number the output is converted to a Double.
IntegerToBigIntegerDecorator
- Converts Integer, Short and Long to to BigInteger. A flag can be set so that on output BigIntegers can be converted to Integers when there is no loss of precision.
BigIntegerToRationalDecorator
- Converts Integer, Short, Long and BigInteger to Rationals. A flag can be set so that if the Rational number can be converted to BigIntegers when there is no loss of precision.
Base classes
Used to make the construction of Fields easier.
AbstractComparativeField
- The comparative operators
eq(l,r), ne(l,r), gt(l,r), ge(l,r), lt(l,r), ge(l,r)
are replaced by a single methodInteger cmp(l,r)
which compare two numbers. GenericField<E>
- Simplifies type conversions. Subclass just need to provide
a method
E cast(Object l)
to convert input to the desired type and methodsE addG(E,E)
etc. which just use the specified type. There is node need to implement theObject add(Object,Object)
methods. GenericPowerField<E>
- Provides an efficient method for calculating integer powers of elements in the field.
The PowerImplementations
class provides
static methods for calculating integer powers of integers, longs and doubles.
-
Interface Summary Interface Description IntegerConvertor Defines fields which can convert numbers to or from integers. -
Class Summary Class Description AbstractComparativeField An abstract base class for fields where comparison methods are implemented using a singlecmp(a,b)
method.BigDecimalField Implementation of field methods using BigDecimalsBigIntegerField An implementation using BigInteger.BigIntegerNumberFactory A number factory to create BigInteger numbersBigIntegerToRationalDecorator Converts BigIntegers, Long, Integer and Short to Rationals on input.BigModulusField A field to work with modulus values of any value, used BigInteger.BooleanField Facilitates standard Boolean logical operations.ComplexField A Field which operates on Complex objects.ComplexFieldWithRealOrder A Field which operates on Complex objects.ComplexNumberFactory Parse all numeric strings asComplex
.DoubleField A double field where all input must be double and all output is double.ExactIntegerField A integer field where results are always integers and Exceptions are thrown on error.FieldDecorator Abstract base class for Decorators used to convert the inputs and outputs of a field operation.GenericField<E> Abstract-generic base class where the type-variable specifies the arguments and return type.GenericPowerField<E> Provides a standardE powI(E l, Integer r)
method for integer powers.IntDoubleNumberFactory Where possible numbers are converted to Integer otherwise Double.IntegerField A integer field where overflows are ignored.IntegerNumberFactory Where possible numbers are converted to Integer otherwise Double.IntegerToBigIntegerDecorator A FieldDecorator which converters Integer/Long/Short to BigIntegers on input, and optionally BigIntegers to Integers on output when there is no loss of precision.LongDoubleNumberFactory Where possible numbers are converted to Long otherwise Double.LongField A field where all operations are implemented using Long.ModulusField A field to work with small modulus values < 46341.NumberAsBooleanField Treat Numbers as boolean values in And &&, Or || and Not !NumberToComplexDecorator Convert all Number types to Complex, and optionally convert result to Doubles if possible.NumberToDoubleDecorator Decorator which converts all Number types to Double.PowerImplementations Fast static routines for calculating powers.Rational A rational number represented as the quotient of two BigIntegers.RationalDivisionPrintRule A special rule for printing divisions involving rational numbers.RationalField A field which works with unlimited precision rational numbers, represented as the quotient of two BigIntegers.RationalNumberFactory CreatesRational
numbers.ShortField A integer field where overflows are ignored.SimpleNumberFactory A simplified base number factory class.StandardField A Field implementation using the default Jep methods for evaluation.StringField String concatenation, and comparison