Class TimestampWeightedTally

    • Constructor Detail

      • TimestampWeightedTally

        public TimestampWeightedTally​(String description)
        constructs a new TimestampWeightedTally with a description.
        Parameters:
        description - String; the description of this TimestampWeightedTally
    • Method Detail

      • isActive

        public boolean isActive()
        Return whether the statistic is active (accepting observations) or not.
        Returns:
        boolean; whether the statistic is active (accepting observations) or not
      • endObservations

        public void endObservations​(Number timestamp)
        End the observations and closes the last interval of observations. After ending, no more observations will be accepted. Calling this method will create an extra observation, and corresponding events for the EventBased implementations of this interface will be called.
        Parameters:
        timestamp - Number; the Number object representing the final timestamp
      • endObservations

        public void endObservations​(Calendar timestamp)
        End the observations and closes the last interval of observations. After ending, no more observations will be accepted. Calling this method will create an extra observation, and corresponding events for the EventBased implementations of this interface will be called.
        Parameters:
        timestamp - Calendar; the Calendar object representing the final timestamp
      • getLastValue

        public double getLastValue()
        Return the last observed value.
        Returns:
        double; the last observed value
      • register

        public double register​(Calendar timestamp,
                               double value)
        Process one observed Calender-based value. The time used will be the Calendar's time in milliseconds. Silently ignore when a value is registered, but tally is not active, i.e. when endObservations() has been called.
        Parameters:
        timestamp - Calendar; the Calendar object representing the timestamp
        value - double; the value to process
        Returns:
        double; the value
        Throws:
        NullPointerException - when timestamp is null
        IllegalArgumentException - when value is NaN
        IllegalArgumentException - when given timestamp is before last timestamp
      • register

        public double register​(Number timestamp,
                               double value)
        Process one observed Number-based value. Silently ignore when a value is registered, but tally is not active, i.e. when endObservations() has been called.
        Parameters:
        timestamp - Number; the object representing the timestamp
        value - double; the value to process
        Returns:
        double; the value
        Throws:
        NullPointerException - when timestamp is null
        IllegalArgumentException - when value is NaN or timestamp is NaN
        IllegalArgumentException - when given timestamp is before last timestamp
      • register

        public double register​(double timestamp,
                               double value)
        Explicit;y override the double value method signature of WeightedTally to call the right method.
        Process one observed double value. Silently ignore when a value is registered, but tally is not active, i.e. when endObservations() has been called.
        Overrides:
        register in class WeightedTally
        Parameters:
        timestamp - Number; the object representing the timestamp
        value - double; the value to process
        Returns:
        double; the value
        Throws:
        NullPointerException - when timestamp is null
        IllegalArgumentException - when value is NaN or timestamp is NaN
        IllegalArgumentException - when given timestamp is before last timestamp
      • registerValue

        protected double registerValue​(Number timestamp,
                                       double value)
        Process one observed Number-based value. Silently ignore when a value is registered, but tally is not active, i.e. when endObservations() has been called.
        Parameters:
        timestamp - Number; the object representing the timestamp
        value - double; the value to process
        Returns:
        double; the value
        Throws:
        NullPointerException - when timestamp is null
        IllegalArgumentException - when value is NaN or timestamp is NaN
        IllegalArgumentException - when given timestamp is before last timestamp
      • reportHeader

        public static String reportHeader()
        Return a string representing a header for a textual table with a monospaced font that can contain multiple statistics.
        Returns:
        String; header for the textual table.
      • reportLine

        public String reportLine()
        Return a string representing a line with important statistics values for this statistic, for a textual table with a monospaced font that can contain multiple statistics.
        Specified by:
        reportLine in interface Statistic
        Overrides:
        reportLine in class WeightedTally
        Returns:
        String; line with most important values of the statistic
      • reportFooter

        public static String reportFooter()
        Return a string representing a footer for a textual table with a monospaced font that can contain multiple statistics.
        Returns:
        String; footer for the textual table