@@ -20,8 +20,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
20
20
21
21
def determinize : DetWordAutom [T ] = {
22
22
// 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 ]()
25
25
var ix = 0
26
26
27
27
// we compute the dfa with states = bitsets
@@ -30,15 +30,15 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
30
30
31
31
var states = Set (q0, sink) // initial set of sets
32
32
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 ()
35
35
val rest = new mutable.Stack [immutable.BitSet ]
36
36
37
37
rest.push(sink, q0)
38
38
39
39
def addFinal (q : immutable.BitSet ): Unit = {
40
40
if (nfa containsFinal q)
41
- finals = finals.updated(q, selectTag(q, nfa.finals) )
41
+ finals(q) = selectTag(q, nfa.finals)
42
42
}
43
43
def add (Q : immutable.BitSet ): Unit = {
44
44
if (! states(Q )) {
@@ -53,8 +53,8 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
53
53
while (! rest.isEmpty) {
54
54
val P = rest.pop()
55
55
// 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
58
58
ix += 1
59
59
60
60
// make transition map
@@ -69,7 +69,7 @@ private[dtd] class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T])
69
69
70
70
// collect default transitions
71
71
val Pdef = nfa nextDefault P
72
- deftrans = deftrans.updated( P , Pdef )
72
+ deftrans( P ) = Pdef
73
73
add(Pdef )
74
74
}
75
75
0 commit comments