public class CompositeCalculator extends java.lang.Object implements CalculatorEngine
Constructor and Description |
---|
CompositeCalculator(java.util.List<CalculatorEngine> engines) |
Modifier and Type | Method and Description |
---|---|
Data |
calculate(java.lang.Enum<?> opId,
Data... operands)
Performs calculation by applying the specified operation to the operands.
|
boolean |
isSupported(java.lang.Enum<?> opId,
Data... operands)
Checks whether the specified operation is supported for the provided operands.
|
public CompositeCalculator(java.util.List<CalculatorEngine> engines)
public boolean isSupported(java.lang.Enum<?> opId, Data... operands)
CalculatorEngine
isSupported
in interface CalculatorEngine
opId
- 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).public Data calculate(java.lang.Enum<?> opId, Data... operands)
CalculatorEngine
calculate
in interface CalculatorEngine
opId
- Operator identifier. Identifies an operation within a group.operands
- Array of operands.