EDU.ksu.cis.calculator
Interface EncodedOperation
- All Superinterfaces:
- Operation
- All Known Implementing Classes:
- Add, Add, ChangeSigns, ChangeSigns, Divide, Divide, Multiply, Multiply, Power, Power, Remainder, Remainder, Subtract, Subtract, TenToPower, TenToPower, TwoToPower, TwoToPower
- public interface EncodedOperation
- extends Operation
An interface abstracting any operation explicitly encoded within the
implementing class. Arithmetic operations should be encoded in this
fashion so as to decouple the encoding of the operation from the control
of evaluation order.
doOperation
public Object doOperation(Object[] operands)
throws IllegalArgumentException,
ClassCastException,
Exception
- Performs the operation.
- 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 has an
incorrect length.
ClassCastException
- If operands contains an
element of an unexptected type.
Exception
- The operation may throw any Exception.
IllegalArgumentException