reactor/Core/src/jetbrains/mps/logic/reactor/util/ClassicIndexedTermTrie.kt [316:342]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun terms2bases(): Pair>, List>> { // for every current node there is a number // initially 0 // counting down with every call to allNext() // increased by current node's arity val terms = ArrayList>() val bases = ArrayList>() val stack = arrayListOf(allNext() to 0) while (stack.isNotEmpty()) { val (nn, count) = stack.pop() for (n in nn) { val newCount = count + n.arity if (newCount == 0) { bases.add(n) } else { terms.add(n) stack.push(n.allNext() to (newCount - 1)) } } } return terms to bases - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - reactor/Core/src/jetbrains/mps/logic/reactor/util/ClassicTermTrie.kt [271:297]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fun terms2bases(): Pair>, List>> { // for every current node there is a number // initially 0 // counting down with every call to allNext() // increased by current node's arity val terms = ArrayList>() val bases = ArrayList>() val stack = arrayListOf(allNext() to 0) while (stack.isNotEmpty()) { val (nn, count) = stack.pop() for (n in nn) { val newCount = count + n.arity if (newCount == 0) { bases.add(n) } else { terms.add(n) stack.push(n.allNext() to (newCount - 1)) } } } return terms to bases - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -