From f09ea00fdd1cb7668a1dd8b99268af9b2857dede Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Thu, 29 Jun 2023 00:32:17 +0200 Subject: [PATCH] Certification toString improvements - Detect delegations based on depth - Add scope regexes for delegations --- .../org/pgpainless/wot/dijkstra/sq/Certification.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/Certification.kt b/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/Certification.kt index 45bb32a3..a7c988a0 100644 --- a/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/Certification.kt +++ b/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/Certification.kt @@ -49,9 +49,11 @@ data class Certification( this(issuer, target, targetUserId, creationTime, null, true, 120, Depth.limited(0), RegexSet.wildcard()) override fun toString(): String { - return if (userId != null) - "$issuer certifies [$userId] ${target.fingerprint}" - else - "$issuer delegates to ${target.fingerprint}" + return if (trustDepth.limit == 0) + "${issuer.fingerprint} certifies binding: $userId <-> ${target.fingerprint} [$trustAmount]" + else { + val scope = if (regexes.regexStrings.isEmpty()) "" else ", scope: $regexes" + "${issuer.fingerprint} delegates to ${target.fingerprint} [$trustAmount, depth $trustDepth$scope]" + } } } \ No newline at end of file