From: Francis Russell Date: Sat, 4 Feb 2012 15:32:49 +0000 (+0000) Subject: Improve tree rendering. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=f407211911ee1dc6c08e503090f8ffe994a9c6ab;p=francis%2Fofc.git Improve tree rendering. --- diff --git a/src/ofc/generators/onetep/LoopTree.scala b/src/ofc/generators/onetep/LoopTree.scala index a7eee75..e4edd88 100644 --- a/src/ofc/generators/onetep/LoopTree.scala +++ b/src/ofc/generators/onetep/LoopTree.scala @@ -224,7 +224,11 @@ class LoopTree private[onetep](localIndex: Option[Index]) { override def toString : String = toStrings.mkString("\n") private def toStrings : List[String] = { - val result = ArrayBuffer[String]("Index: " + localIndex) + val result = ArrayBuffer[String]() + result += "Index: " + (localIndex match { + case Some(x) => x.toString + case None => "None" + }) for (entryID <- 0 until subItems.size) { val subList = (subItems(entryID) match { @@ -232,8 +236,9 @@ class LoopTree private[onetep](localIndex: Option[Index]) { case Right(tree) => tree.toStrings }) - val prefix = if (entryID < subItems.size-1) "| " else " " - result ++= "`--"+subList.head :: (subList.tail.map(prefix+_)) + val subListHeadPrefix = if (entryID < subItems.size-1) "|--" else "`--" + val subListTailPrefix = if (entryID < subItems.size-1) "| " else " " + result ++= (subListHeadPrefix+subList.head) :: (subList.tail.map(subListTailPrefix+_)) } result.toList