public interface CalculatorEngine
CalculatorEngine
interface is an interface to be implemented by all calculator
engines. Calculator engines perform calculations using operations united into a group. Operation
groups are represented by corresponding enumerations that list supported operations.Modifier and Type | Method and Description |
---|---|
Data |
calculate(java.lang.Enum<?> operatorId,
Data... operands)
Performs calculation by applying the specified operation to the operands.
|
boolean |
isSupported(java.lang.Enum<?> operatorId,
Data... operands)
Checks whether the specified operation is supported for the provided operands.
|
boolean isSupported(java.lang.Enum<?> operatorId, Data... operands)
operatorId
- Operator identifier. Identifies an operation within a group.operands
- Array of operands.true
if the operation is supported for the given operand types or false
if it is not supported or its invariants are violated (e.g. operand types do not
match).Data calculate(java.lang.Enum<?> operatorId, Data... operands)
operatorId
- Operator identifier. Identifies an operation within a group.operands
- Array of operands.java.lang.UnsupportedOperationException
- if the operation is not supported or its invariants are
violated (e.g. operand types do not match).