Search in sources :

Example 6 with StatsDaily

use of me.semx11.autotip.stats.StatsDaily in project Hyperium by HyperiumClient.

the class StatsManager method getRange.

/**
 * Get the {@link StatsRange} for the specified date range. This method uses {@link
 * #get(LocalDate)} to get all the {@link StatsDaily} that are contained within this range.
 *
 * @param start The starting {@link LocalDate}
 * @param end   The ending {@link LocalDate}
 * @return {@link StatsRange} for the specified date range
 */
public StatsRange getRange(LocalDate start, LocalDate end) {
    if (start.isBefore(fileUtil.getFirstDate()))
        start = fileUtil.getFirstDate();
    if (end.isAfter(LocalDate.now()))
        end = LocalDate.now();
    StatsRange range = new StatsRange(autotip, start, end);
    Stream.iterate(start, date -> date.plusDays(1)).limit(ChronoUnit.DAYS.between(start, end) + 1).forEach(date -> range.merge(get(date)));
    return range;
}
Also used : StatsRange(me.semx11.autotip.stats.StatsRange)

Aggregations

StatsDaily (me.semx11.autotip.stats.StatsDaily)4 GlobalSettings (me.semx11.autotip.config.GlobalSettings)3 DateTimeFormatter (java.time.format.DateTimeFormatter)2 Autotip (me.semx11.autotip.Autotip)2 MessageOption (me.semx11.autotip.chat.MessageOption)2 MessageUtil (me.semx11.autotip.chat.MessageUtil)2 Config (me.semx11.autotip.config.Config)2 InvokeEvent (cc.hyperium.event.InvokeEvent)1 JsonSyntaxException (com.google.gson.JsonSyntaxException)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 DecimalFormat (java.text.DecimalFormat)1 NumberFormat (java.text.NumberFormat)1 DayOfWeek (java.time.DayOfWeek)1 LocalDate (java.time.LocalDate)1 LocalTime (java.time.LocalTime)1 DateTimeParseException (java.time.format.DateTimeParseException)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1