Class CompositeCalculator

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CompositeCalculator

        public CompositeCalculator​(java.util.List<CalculatorEngine> engines)
    • Method Detail

      • isSupported

        public boolean isSupported​(java.lang.Enum<?> opId,
                                   Data... operands)
        Description copied from interface: CalculatorEngine
        Checks whether the specified operation is supported for the provided operands. Operation identifier and operand types are taken into consideration.
        Specified by:
        isSupported in interface CalculatorEngine
        Parameters:
        opId - Operator identifier. Identifies an operation within a group.
        operands - Array of operands.
        Returns:
        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).
      • calculate

        public Data calculate​(java.lang.Enum<?> opId,
                              Data... operands)
        Description copied from interface: CalculatorEngine
        Performs calculation by applying the specified operation to the operands.
        Specified by:
        calculate in interface CalculatorEngine
        Parameters:
        opId - Operator identifier. Identifies an operation within a group.
        operands - Array of operands.
        Returns:
        Data object holding the calculated value.