]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Improve tree rendering.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Sat, 4 Feb 2012 15:32:49 +0000 (15:32 +0000)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Sat, 4 Feb 2012 15:32:49 +0000 (15:32 +0000)
src/ofc/generators/onetep/LoopTree.scala

index a7eee751bba416b6b1e785d171a8d8d553b118a6..e4edd88e7b446989c740ddd7524baa04b9fa3f9c 100644 (file)
@@ -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