Class CalculateIntegerSum


  • public class CalculateIntegerSum
    extends java.lang.Object
    Helper class to sum up Integer-Channels.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.function.Function<java.lang.Integer,​java.lang.Integer> DIRECT_CONVERTER  
      static java.util.function.Function<java.lang.Integer,​java.lang.Integer> DIVIDE_BY_THREE  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addValue​(Channel<java.lang.Integer> channel)
      Adds a Channel-Value.
      void addValue​(Channel<java.lang.Integer> channel, java.util.function.Function<java.lang.Integer,​java.lang.Integer> converter)
      Adds a Channel-Value.
      java.lang.Integer calculate()
      Calculates the sum.
      • Methods inherited from class java.lang.Object

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

      • DIRECT_CONVERTER

        public static final java.util.function.Function<java.lang.Integer,​java.lang.Integer> DIRECT_CONVERTER
      • DIVIDE_BY_THREE

        public static final java.util.function.Function<java.lang.Integer,​java.lang.Integer> DIVIDE_BY_THREE
    • Constructor Detail

      • CalculateIntegerSum

        public CalculateIntegerSum()
    • Method Detail

      • addValue

        public void addValue​(Channel<java.lang.Integer> channel)
        Adds a Channel-Value.
        Parameters:
        channel - the Channel
      • addValue

        public void addValue​(Channel<java.lang.Integer> channel,
                             java.util.function.Function<java.lang.Integer,​java.lang.Integer> converter)
        Adds a Channel-Value.
        Parameters:
        channel - the Channel
        converter - is applied to the channel value
      • calculate

        public java.lang.Integer calculate()
                                    throws java.util.NoSuchElementException
        Calculates the sum.
        Returns:
        the sum or null
        Throws:
        java.util.NoSuchElementException - on error