EDU.ksu.cis.calculator.defaultmodel
Class Remainder

java.lang.Object
  |
  +--EDU.ksu.cis.calculator.defaultmodel.Remainder
All Implemented Interfaces:
EncodedOperation, Operation

public class Remainder
extends Object
implements EncodedOperation

The remainder operation.

Author:
Rod Howell (howell@cis.ksu.edu)

Constructor Summary
Remainder()
           
 
Method Summary
 Object doOperation(Object[] operands)
          Returns the remainder obtained when dividing operand[0] by operand[1].
 int numOperands()
          Returns 2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Remainder

public Remainder()
Method Detail

numOperands

public int numOperands()
Returns 2.

Specified by:
numOperands in interface Operation

doOperation

public Object doOperation(Object[] operands)
                   throws ArrayIndexOutOfBoundsException,
                          ClassCastException,
                          ArithmeticException
Returns the remainder obtained when dividing operand[0] by operand[1].

Specified by:
doOperation in interface EncodedOperation
Parameters:
operands - The operands for the operation. The length of this array should match the value returned by Operation.numOperands().
Returns:
The result of the operation.
Throws:
ArrayIndexOutOfBoundsException - If operands is not of length at least 2.
ClassCastException - If the elements of operands are not both LargeIntegers.
ArithmeticException - If operand[1] is zero.