package bigRat; /** * This interface represents rational numbers. * * @author Claude Anderson and Curt Clifton * @param * the type of the other object in binary operations and the return * type for methods */ public interface Rational> extends Comparable { /** * Returns a Rational whose value is the absolute value of this Rational. * * @return | this | */ public S abs(); /** * Returns a Rational whose value is the sum of this and other. * * @param other * the other rational number to be added to this one. * @return this + other */ public S add(S other); /** * Returns a Rational whose value is the quotient of this and other. * * @param other * the rational number by which to divide this one * @return this / other */ public S divide(S other); /** * Compares this rational to the other one * * @param other * the rational number to which this should be compared * @return true iff this Rational represents the same fraction as other. */ public boolean equals(Object other); /** * Returns a String representing this Rational as a reduced * fraction numerator/denominator. * * @return numerator + "/" + denominator */ public String toString(); }