Class Duration


  • public class Duration
    extends Object
    Immutable duration for retrieving statistics. A duration of time is uniquely identified by its span. For instance, a duration of 3 minutes doesn't imply a specific start time. It can start at any time, but it takes just 3 minutes. A Duration can be used to sample a Period of time. For instance the period between November 1th 2007 and December 1th 2007 can be divided in samples each having a duration of 3 days.
    • Constructor Detail

      • Duration

        public Duration​(int years,
                        int months,
                        int weeks,
                        int days)
        Creates a duration by specifying a value for each of its fields.
        Parameters:
        years - The number of years
        months - The number of months
        weeks - The number of weeks
        days - The number of days
      • Duration

        public Duration​(int years,
                        int months,
                        int weeks,
                        int days,
                        int hours)
        Creates a duration by specifying a value for each of its fields.
        Parameters:
        years - The number of years
        months - The number of months
        weeks - The number of weeks
        days - The number of days
    • Method Detail

      • getYears

        public int getYears()
        Returns:
        The number of years this duration has
      • getMonths

        public int getMonths()
        Returns:
        The number of months this duration has
      • getWeeks

        public int getWeeks()
        Returns:
        The number of weeks this duration has
      • getDays

        public int getDays()
        Returns:
        The number of days this duration has
      • getHours

        public int getHours()
        Returns:
        The number of hours this duration has