val indices = space.getIndices
val localSortedIndices = sortedIndices filter (indices.contains(_))
base.addIterationSpace(localSortedIndices, space)
- println(localSortedIndices.toString + " -> "+space)
}
println(base)
private def getEndLoop(index: Index) : LoopTree = {
def newTree = { val tree = new LoopTree(Some(index)); subItems += Right(tree); tree}
- if (subItems.isEmpty)
- newTree
- else
- subItems.last match {
- case Right(tree) => if (tree.getLocalIndex == Some(index)) tree else newTree
- case _ => newTree
- }
+ var destination : Option[LoopTree]= None
+ for(item <- subItems)
+ item match {
+ case Right(tree) => if (tree.getLocalIndex == Some(index)) destination = Some(tree)
+ case _ =>
+ }
+
+ destination match {
+ case Some(tree) => tree
+ case None => newTree
+ }
}
private def getLocalIndex = localIndex