/*
 * Accumulator.java:
 *
 * An abstract class, representing the 71-bit accumulator. The main
 * arithmetical operations will take place inside this object, and the
 * object will be mutable, containing the result of operations.
 *
 * Changes:
 *   25/01/1999 - sgf22 - Created.
 */

import java.math.BigInteger;

abstract class Accumulator {
  // Constructor method
  abstract Accumulator();

  // Get the value from the accumulator
  abstract ShortWord shortValue();
  abstract LongWord longValue();

  // Add a number to the accumulator
  abstract void addShort(ShortWord i);
  abstract void addLong(LongWord i);

  // Subtract a number from the accumulator
  abstract void subShort(ShortWord i);
  abstract void subLong(LongWord i);

  // Multiply operations
  abstract void multAdd(LongWord i, LongWord j);
  abstract void multSub(LongWord i, LongWord j);

  // 'Collate' (logical 'and') routines
  abstract void shortCollate(ShortWord i, LongWord j);
  abstract void longCollate(LongWord i, LongWord j);

  // Shift routines - parameter is address field of the instruction
  abstract void shiftLeft(Address amount);
  abstract void shiftRight(Address amount);

  // Comparison routines
  abstract boolen isPositive();
  abstract boolen isNegative();

  // Clear accumulator
  abstract void clear();
  
  // Round accumulator to 34 bits
  abstract void round();

  // Routines for debugging:
  
  // Return the value held in the accumulator as a BigInteger
  abstract BigInteger bigIntValue();

  // Return the value held in the accumulator as a fraction -1 < x <1
  abstract double fractValue();

  // Display information on the contents:
  abstract String toString();
}
