Move SSD shield label helper to typed Kotlin
ober
d3724a929020aff470f4335e6f3727e70bb6f888
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -227,6 +227,25 @@ "hydran" ""))))))))))))) + (typed-kotlin-file "com/sfb/ssdreview/ShieldLabel.kt" + (typed-library (com sfb ssdreview) + (export shieldLabel) + (type Float32) + (def (shieldLabel (rx : Float32) (ry : Float32)) : String + (if (< ry (float32 0.26)) + "shield-1" + (if (and (> rx (float32 0.70)) (< ry (float32 0.58))) + "shield-2" + (if (and (> rx (float32 0.58)) (>= ry (float32 0.58))) + "shield-3" + (if (> ry (float32 0.72)) + "shield-4" + (if (and (< rx (float32 0.42)) (>= ry (float32 0.58))) + "shield-5" + (if (< rx (float32 0.30)) + "shield-6" + "shield"))))))))) + (typed-kotlin-file "com/sfb/ssdreview/NativeDetection.kt" (typed-library (com sfb ssdreview) (export make-NativeDetection NativeDetection? @@ -558,16 +577,6 @@ " }" " return Guess(\"${count} boxes\", \"\", \"unclassified detected group\")" " }" - "" - " private fun shieldLabel(rx: Float, ry: Float): String = when {" - " ry < 0.26f -> \"shield-1\"" - " rx > 0.70f && ry < 0.58f -> \"shield-2\"" - " rx > 0.58f && ry >= 0.58f -> \"shield-3\"" - " ry > 0.72f -> \"shield-4\"" - " rx < 0.42f && ry >= 0.58f -> \"shield-5\"" - " rx < 0.30f -> \"shield-6\"" - " else -> \"shield\"" - " }" "}" "" ))