39 lines
1.0 KiB
Kotlin
39 lines
1.0 KiB
Kotlin
package moe.kageru.spektacles
|
|
|
|
import moe.kageru.spektacles.Node.Leaf
|
|
import kotlin.system.measureTimeMillis
|
|
|
|
fun main() {
|
|
val time = measureTimeMillis {
|
|
spektacle()
|
|
}
|
|
println("Time spent: $time ms")
|
|
}
|
|
|
|
fun spektacle() {
|
|
IoHandler.readFile("test.log")
|
|
.parse()
|
|
.filterUsers("kageru_").toList()
|
|
.filter { it.getMention().nonEmpty() }
|
|
.toLeaf<String, ParsedLine>()
|
|
.groupBy { it.time.year.toString() }
|
|
.groupBy { it.time.monthValue.toString() }
|
|
.groupBy { it.getMention().orNull()!! }
|
|
.countLeafs()
|
|
.sort()
|
|
//.grouped { it.time.year }
|
|
//.mapValues { it.value.groupBy { it.time.month } }.k()
|
|
//.ap(mapOf(
|
|
//1 to { lines: Map<Month, List<ParsedLine>> -> lines },
|
|
//2 to {lines -> lines.filterKeys { it < Month.APRIL }}
|
|
//).k())
|
|
//.let { it }
|
|
//.filterModes(UserMode.OP)
|
|
//.filterMonths(Month.APRIL)
|
|
//.heatMapByHour()
|
|
//.deepMap { it.message }
|
|
.let(::println)
|
|
}
|
|
|
|
private fun <K, T: Any> List<T>.toLeaf(): Node<K, T> = Leaf(this)
|