16 lines
490 B
Kotlin
16 lines
490 B
Kotlin
package moe.kageru.spektacles
|
|
|
|
import java.time.Month
|
|
|
|
fun ParsedLines.heatMapByHour(): SortedCounter<Int> = heatMapBy { it.time.hour }
|
|
|
|
fun ParsedLines.heatMapByMinute(): SortedCounter<Int> = heatMapBy { it.time.hour * 100 + it.time.minute }
|
|
|
|
fun ParsedLines.heatMapByMonth(): SortedCounter<Month> = heatMapBy { it.time.month }
|
|
|
|
private fun <T: Comparable<T>>ParsedLines.heatMapBy(op: (ParsedLine) -> T): SortedCounter<T> {
|
|
return this.map(op)
|
|
.asIterable()
|
|
.toSortedCounter()
|
|
}
|