Class CalculateAverage


  • public class CalculateAverage
    extends java.lang.Object
    Helper class to calculate the average of Channel-Values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addValue​(Channel<java.lang.Integer> channel)
      Adds a Channel-Value.
      java.lang.Double calculate()
      Calculates the average.
      java.lang.Integer calculateRounded()
      Calculates the average and rounds to Integer.
      • Methods inherited from class java.lang.Object

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

      • CalculateAverage

        public CalculateAverage()
    • Method Detail

      • addValue

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

        public java.lang.Double calculate()
                                   throws java.util.NoSuchElementException
        Calculates the average.
        Returns:
        the average or null
        Throws:
        java.util.NoSuchElementException
      • calculateRounded

        public java.lang.Integer calculateRounded()
                                           throws java.util.NoSuchElementException
        Calculates the average and rounds to Integer.
        Returns:
        the average or null
        Throws:
        java.util.NoSuchElementException