Clean
This commit is contained in:
@@ -3,6 +3,7 @@ package be.vandewalleh.aoc.utils
|
||||
import be.vandewalleh.aoc.utils.factory.findDayDefinition
|
||||
import io.micronaut.context.BeanContext
|
||||
import java.time.LocalDate
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
fun runDay(day: Int = LocalDate.now().dayOfMonth) {
|
||||
val ctx = BeanContext.run()
|
||||
@@ -14,23 +15,18 @@ fun runDay(day: Int = LocalDate.now().dayOfMonth) {
|
||||
}
|
||||
|
||||
val instance = ctx.getBean(definition)
|
||||
val part1Handle = ctx.findExecutionHandle<Any, Any>(instance, "part1")
|
||||
if (part1Handle.isEmpty) {
|
||||
println("part1() not found")
|
||||
return
|
||||
}
|
||||
|
||||
println("*** Day $day ***")
|
||||
println()
|
||||
println("part 1:")
|
||||
println(part1Handle.get().invoke())
|
||||
|
||||
println()
|
||||
val part2Handle = ctx.findExecutionHandle<Any, Any>(instance, "part2")
|
||||
if (part2Handle.isEmpty) {
|
||||
println("part2() not found")
|
||||
return
|
||||
val p1: Any
|
||||
val ms1 = measureTimeMillis {
|
||||
p1 = instance.part1()
|
||||
}
|
||||
println("part 2:")
|
||||
println(part2Handle.get().invoke())
|
||||
println("part 1 ($ms1 ms): $p1")
|
||||
|
||||
val p2: Any
|
||||
val ms2 = measureTimeMillis {
|
||||
p2 = instance.part2()
|
||||
}
|
||||
println("part 2 ($ms2 ms): $p2")
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
package be.vandewalleh.aoc.utils.input
|
||||
|
||||
import io.micronaut.context.annotation.Executable
|
||||
import io.micronaut.context.annotation.Prototype
|
||||
import io.micronaut.core.annotation.Introspected
|
||||
import jakarta.inject.Qualifier
|
||||
@@ -12,5 +11,4 @@ import jakarta.inject.Qualifier
|
||||
@Introspected
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@Executable
|
||||
annotation class Day(val value: Int = -1)
|
||||
|
||||
Reference in New Issue
Block a user