com.rubecula.jquantity
Interface Divisible

All Known Implementing Classes:
Approximation, Complex, Compound, DivisibleMutable, JQuantity

public interface Divisible

Interface to define Divisible arithmetical operations. Essentially these are operations which can transform an integer (or any number) into a non-integer.

Since:
V_0_1
Version:
$Revision: 1.7 $
Author:
Robin Hillyard

Method Summary
 Divisible factored(double factor)
          Method to yield the quotient of this divided by factor, and return it as the result.
 Divisible inverse()
          Method to yield the reciprocal of this and return it as the result.
 Divisible quotient(BaseNumber divisor)
          Method to divide this by divisor and return the quotient as the result.
 

Method Detail

inverse

public Divisible inverse()
Method to yield the reciprocal of this and return it as the result.
NOTE: it is a requirement of this method that the class of the result is the same as the class of this so that the result can be safely cast to the original class.

Returns:
the reciprocal of this.

quotient

public Divisible quotient(BaseNumber divisor)
                   throws InvalidOperandException
Method to divide this by divisor and return the quotient as the result.
NOTE: it is a requirement of this method that the class of the result is the same as the class of this so that the result can be safely cast to the original class.
NOTE: This method is dangerous as it is possible that the divisor is a non-pure number such as a Value. Instead of using this method, it is better to use inverse and then product.

Parameters:
divisor - the number to multiply by this.
Returns:
the quotient of this divided by divisor.
Throws:
InvalidOperandException - operands are not compatible for the quotient operation. // TODO Fix it so that this method is safe (see above).

factored

public Divisible factored(double factor)
Method to yield the quotient of this divided by factor, and return it as the result.
NOTE: it is a requirement of this method that the class of the result is the same as the class of this so that the result can be safely cast to the original class.

Parameters:
factor - the scale factor.
Returns:
the quotient of this divided by factor.