Removed ambiguity in method calls the IBM Jikes compiler complained
about
Changed documentation of classes and methods, removed documentation for
methods documented by an interface or a superclass
Where appropriate, classes use the new ExceptionSupport helper
class when checking conditions and throwing exceptions
Where appropriate, classes now use the NumberCentral class instead
of the NumberFactory, which has changed to an interface
Renamed fields, methods:
In interface RealNumber:
Renamed isFitsByte to fitsByte
Renamed isFitsShort to fitsShort
Renamed isFitsInt to fitsInt
Renamed isFitsLong to fitsLong
In interface NumberFactory:
Renamed method createSum to add
Renamed method createProduct to multiply
Renamed method createPower to pow
Removed fields, methods:
Removed a method from BasicRationalNumber:
protected void normalize() Normalization is now done in the constructor.
Added interfaces, classes:
public class ExceptionSupport Checks conditions and throws exceptions if appropriate
public class CanNotCompareException Exception thrown when two numbers cannot be compared
public class NumberCentral Static factory for RealNumber instances, it uses a NumberFactory
instance
Added fields, methods:
Added methods to interface RealNumber:
public boolean fitsDouble
public boolean fitsFloat
public int retryCompare(RealNumber n) throws CanNotCompareException
Added methods to interface RationalNumber:
public int compareTo(RationalNumber n) this method does not throw a CanNotCompareException
Added methods to interface IntegerNumber:
public int compareTo(IntegerNumber n) this method does not throw a CanNotCompareException
public boolean isRelativePrime(IntegerNumber n)
Added methods to interface NumberFactory:
public RationalNumber createFraction(long numerator, long denominator)
public IntegerNumber createRandomInteger(int maxBytes)
Added methods to abstract class AbstractIntegerNumber to reflect
changes in interface IntegerNumber:
public int compareTo(IntegerNumber n)
public boolean isRelativePrime(IntegerNumber n)
Added fields to class LongIntegerNumber (cached instances):
public LongIntegerNumber THREE
public LongIntegerNumber FOUR
public LongIntegerNumber FIVE
public LongIntegerNumber SIX
public LongIntegerNumber SEVEN
public LongIntegerNumber EIGHT
public LongIntegerNumber NINE
public LongIntegerNumber TEN
public LongIntegerNumber MINIMUM_VALUE
public LongIntegerNumber MAXIMUM_VALUE
Added field to class DefaultNumberFactory:
public java.util.Random randomGenerator
Added methods to class DefaultNumberFactory to reflect changes
in NumberFactory:
public RationalNumber createFraction(long numerator, long denominator)
public IntegerNumber createRandomInteger(int maxBytes)
Changed implementation:
Changed the compareTo(RealNumber n) method in interface RealNumber.
The contract has been changed and the CanNotCompareException exception
is declared.
Changed NumberFactory from an abstract class to an interface.
The default property was moved to the new NumberCentral
class and renamed to defaultFactory.
In interface NumberFactory the following methods have been declared
to throw an IllegalArgumentException:
createInteger(byte[] bytes)
valueOf(BigInteger n)
Changed methods in AbstractIntegerNumber:
gcd(IntegerNumber) optimized
invert() optimized
Changed the following fields to public final:
In class BasicRationalNumber: protected IntegerNumber numerator
In class BasicRationalNumber: protected IntegerNumber denominator
In class LongIntegerNumber: protected long value
Changed the access modifiers for the following fields from default (package
protected) to public:
BasicRationalNumber.ONE_HALF
BasicRationalNumber.MINUS_ONE_HALF
LongIntegerNumber.MINUS_TWO
LongIntegerNumber.MINUS_ONE
LongIntegerNumber.ZERO
LongIntegerNumber.ONE
LongIntegerNumber.TWO
Changed LongIntegerNumber.createInstance(long) to return the added
cached instances, if possible.
Changes between 1.0a3 and 1.0a2
Renamed interfaces, classes:
Renamed RealNumberFactory to NumberFactory
Renamed DefaultRealNumberFactory to DefaultNumberFactory
Renamed fields, methods:
In abstract class NumberFactory:
Renamed method createIntegerNumber(byte[]) to createInteger(byte[])
In class DefaultNumberFactory:
Renamed field theInstance to SHARED_INSTANCE
In abstract class AbstractRealNumber:
Renamed field factory to numberFactory
Added interfaces, classes:
public interface CompositeNumber
public abstract class AbstractCompositeNumber
public class Sum
public class Product
public class Power
Added fields, methods:
Added methods to interface RealNumber:
public boolean isFitsInt()
public boolean isFitsShort()
public boolean isFitsByte()
public boolean isFitsDouble()
public boolean isFitsFloat()
public int intValue()
public short shortValue()
public byte byteValue()
public BigInteger toBigInteger()
public float floatValue()
Added methods to abstract class AbstractRealNumber:
public long longValue()
public double doubleValue()
public BigInteger toBigInteger()
public BigDecimal toBigDecimal(int)
Added methods to abstract class NumberFactory:
public RealNumber createSum(RealNumber a, RealNumber b)
public RealNumber createProduct(RealNumber a, RealNumber b)
public RealNumber createPower(RealNumber base, RealNumber exponent)
Changed implementation:
Changed methods in class AbstractRealNumber:
add(RealNumber) now returns result of NumberFactory.createSum()
instead of null.
multiply(RealNumber) now returns result of NumberFactory.createProduct()
instead of null.
pow(RealNumber) now returns result of NumberFactory.createPower()
instead of null.
If you have any comments, suggestions, etc.
please mail Ernst de Haan at znerd@hotmail.com