master > master: code go - vereinfachte logging

This commit is contained in:
RD
2021-11-04 11:06:16 +01:00
parent 701032a109
commit 552c3197e8
20 changed files with 235 additions and 235 deletions

View File

@@ -5,7 +5,6 @@ package interpol
* ---------------------------------------------------------------- */
import (
"fmt"
"math"
"ads/internal/core/logging"
@@ -31,23 +30,23 @@ Outputs: Position von x in L, sonst 1 wenn x nicht in L.
*/
func InterpolationSearch(L []int, x int, u int, v int) int {
if len(L) == 0 {
logging.LogDebug(fmt.Sprintf("Liste L leer, also x nicht in L"))
logging.Debug("Liste L leer, also x nicht in L")
return -1
} else if !(L[u] <= x && x <= L[v]) {
logging.LogDebug(fmt.Sprintf("x liegt außerhalb der Grenzen von L"))
logging.Debug("x liegt außerhalb der Grenzen von L")
return -1
}
metrics.AddTimeCost()
p := getSuchposition(L, x, u, v)
logging.LogDebug(fmt.Sprintf("Interpolante von x in (u, v)=(%[1]v, %[2]v) ist p = %[3]v.", u, v, p))
logging.Debug("Interpolante von x in (u, v)=(%[1]v, %[2]v) ist p = %[3]v.", u, v, p)
if L[p] == x {
logging.LogDebug(fmt.Sprintf("x in Position p gefunden"))
logging.Debug("x in Position p gefunden")
return p
} else if x < L[p] {
logging.LogDebug(fmt.Sprintf("Suche in linker Hälfte fortsetzen."))
logging.Debug("Suche in linker Hälfte fortsetzen.")
return InterpolationSearch(L, x, u, p-1)
} else { // } else if x > L[p] {
logging.LogDebug(fmt.Sprintf("Suche in rechter Hälfte fortsetzen."))
logging.Debug("Suche in rechter Hälfte fortsetzen.")
return InterpolationSearch(L, x, p+1, v)
}
}