Move SSD truth index comparison to typed Kotlin
ober
9a2f0918f56bcbfe49f1940cadf520c86d8f6c50
--- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -317,7 +317,7 @@ TruthIndexEntry-file TruthIndexEntry-sourceKey TruthIndexEntry-sourceName TruthIndexEntry-canonicalSourceName TruthIndexEntry-page TruthIndexEntry-dpi TruthIndexEntry-groupCount - TruthIndexEntry-truthTime) + TruthIndexEntry-truthTime betterTruthIndex) (type File) (type URL) (type Int32) @@ -337,7 +337,15 @@ (page : Int32) (dpi : Int32) (groupCount : Int32) - (truthTime : Int))))) + (truthTime : Int))) + (def (betterTruthIndex (candidate : TruthIndexEntry) + (current : TruthIndexEntry)) : Bool + (or (> (TruthIndexEntry-groupCount candidate) + (TruthIndexEntry-groupCount current)) + (and (equal? (TruthIndexEntry-groupCount candidate) + (TruthIndexEntry-groupCount current)) + (> (TruthIndexEntry-truthTime candidate) + (TruthIndexEntry-truthTime current))))))) (typed-kotlin-file "com/sfb/ssdreview/Guess.kt" (typed-library (com sfb ssdreview) @@ -3984,10 +3992,6 @@ " }" " }" "" - " private fun betterTruthIndex(candidate: TruthIndexEntry, current: TruthIndexEntry): Boolean =" - " candidate.groupCount > current.groupCount ||" - " (candidate.groupCount == current.groupCount && candidate.truthTime > current.truthTime)" - "" " fun saveSession(session: SsdSession): File =" " saveTruthSnapshot(ssdSessionToTruthJson(session))" ""