@@ -20,8 +20,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
2020
2121 def determinize : DetWordAutom [T ] = {
2222 // for assigning numbers to bitsets
23- var indexMap = scala.collection .Map [immutable.BitSet , Int ]()
24- var invIndexMap = scala.collection .Map [Int , immutable.BitSet ]()
23+ val indexMap = mutable .Map [immutable.BitSet , Int ]()
24+ val invIndexMap = mutable .Map [Int , immutable.BitSet ]()
2525 var ix = 0
2626
2727 // we compute the dfa with states = bitsets
@@ -30,15 +30,15 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
3030
3131 var states = Set (q0, sink) // initial set of sets
3232 val delta = new mutable.HashMap [immutable.BitSet , mutable.HashMap [T , immutable.BitSet ]]
33- var deftrans = mutable.Map (q0 -> sink, sink -> sink) // initial transitions
34- var finals : mutable.Map [immutable.BitSet , Int ] = mutable.Map ()
33+ val deftrans = mutable.Map (q0 -> sink, sink -> sink) // initial transitions
34+ val finals : mutable.Map [immutable.BitSet , Int ] = mutable.Map ()
3535 val rest = new mutable.Stack [immutable.BitSet ]
3636
3737 rest.push(sink, q0)
3838
3939 def addFinal (q : immutable.BitSet ): Unit = {
4040 if (nfa containsFinal q)
41- finals = finals.updated(q, selectTag(q, nfa.finals) )
41+ finals(q) = selectTag(q, nfa.finals)
4242 }
4343 def add (Q : immutable.BitSet ): Unit = {
4444 if (! states(Q )) {
@@ -53,8 +53,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
5353 while (! rest.isEmpty) {
5454 val P = rest.pop()
5555 // assign a number to this bitset
56- indexMap = indexMap.updated( P , ix)
57- invIndexMap = invIndexMap.updated (ix, P )
56+ indexMap( P ) = ix
57+ invIndexMap(ix) = P
5858 ix += 1
5959
6060 // make transition map
@@ -69,7 +69,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
6969
7070 // collect default transitions
7171 val Pdef = nfa nextDefault P
72- deftrans = deftrans.updated( P , Pdef )
72+ deftrans( P ) = Pdef
7373 add(Pdef )
7474 }
7575
0 commit comments