Skip to content
Snippets Groups Projects
Commit 5ed87d42 authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

Printing fixes in Graph

parent 16abfd0d
No related branches found
No related tags found
No related merge requests found
...@@ -78,13 +78,13 @@ class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(pare ...@@ -78,13 +78,13 @@ class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(pare
def pad(prefix: String, message: String): String = { def pad(prefix: String, message: String): String = {
val lines = message.split("\\n").toList val lines = message.split("\\n").toList
val padding = " " * prefix.size val padding = " " * (prefix.length + 1)
prefix + lines.head + "\n" + lines.tail.map(padding + _).mkString("\n") prefix + " " + lines.head + "\n" + lines.tail.map(padding + _).mkString("\n")
} }
import hctx.reporter.info import hctx.reporter.info
val prefix = f"[${Option(ri.rule).getOrElse("?")}%-20s] " val prefix = f"[${Option(ri.rule.asString).getOrElse("?")}%-20s]"
info(pad(prefix, ri.problem.asString)) info(pad(prefix, ri.problem.asString))
...@@ -96,11 +96,11 @@ class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(pare ...@@ -96,11 +96,11 @@ class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(pare
isSolved = sols.nonEmpty isSolved = sols.nonEmpty
if (sols.isEmpty) { if (sols.isEmpty) {
info(prefix+"Failed") info(s"$prefix Failed")
isDeadEnd = true isDeadEnd = true
} else { } else {
val sol = sols.head val sol = sols.head
val morePrefix = s"$prefix Solved ${(if(sol.isTrusted) "" else " (untrusted)")} with: " val morePrefix = s"$prefix Solved ${if(sol.isTrusted) "" else "(untrusted)"} with: "
info(pad(morePrefix, sol.asString)) info(pad(morePrefix, sol.asString))
} }
...@@ -111,8 +111,8 @@ class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(pare ...@@ -111,8 +111,8 @@ class AndNode(parent: Option[Node], val ri: RuleInstantiation) extends Node(pare
} }
case RuleExpanded(probs) => case RuleExpanded(probs) =>
info(prefix+"Decomposed into:") info(s"$prefix Decomposed into:")
val morePrefix = prefix + " - " val morePrefix = s"$prefix -"
for(p <- probs) { for(p <- probs) {
info(pad(morePrefix, p.asString)) info(pad(morePrefix, p.asString))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment