diff options
author | mihaylov <mihaylov@epfl.ch> | 2006-01-22 15:17:27 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2006-01-22 15:17:27 +0000 |
commit | 6dc1abb28a682ea1ad10d1383024f70f7119d318 (patch) | |
tree | f4be19a88add61ec092a23108593c5119452cf8c /src | |
parent | 4a08aae226f83811c52e828a7f849905d2fb0de8 (diff) | |
download | scala-6dc1abb28a682ea1ad10d1383024f70f7119d318.tar.gz scala-6dc1abb28a682ea1ad10d1383024f70f7119d318.tar.bz2 scala-6dc1abb28a682ea1ad10d1383024f70f7119d318.zip |
Adjusted to the new interface of BitSet
Diffstat (limited to 'src')
4 files changed, 20 insertions, 25 deletions
diff --git a/src/library/scala/util/automata/NondetWordAutom.scala b/src/library/scala/util/automata/NondetWordAutom.scala index a0a2757233..8ff99cc369 100644 --- a/src/library/scala/util/automata/NondetWordAutom.scala +++ b/src/library/scala/util/automata/NondetWordAutom.scala @@ -26,7 +26,7 @@ abstract class NondetWordAutom[T <: AnyRef] { /** returns true if the set of states contains at least one final state */ final def containsFinal(Q: immutable.BitSet): Boolean = { - val it = Q.toSet(true).elements; + val it = Q.elements; while( it.hasNext ) if( isFinal( it.next )) return true; @@ -54,23 +54,23 @@ abstract class NondetWordAutom[T <: AnyRef] { /** returns a bitset with the next states for given state and label */ def next(Q:immutable.BitSet, a: T): immutable.BitSet = { val x = new mutable.BitSet(nstates); - for(val q <- Q.toSet(true)) { - for(val i <- next(q,a).toSet(true)) { - x.set(i); + for(val q <- Q) { + for(val i <- next(q,a)) { + x += i; } } - x.makeImmutable + x.toImmutable } def nextDefault(Q:immutable.BitSet): immutable.BitSet = { val x = new mutable.BitSet(nstates); - for(val q <- Q.toSet(true)) { - for(val i <- default(q).toSet(true)) { //@todo: OR - x.set(i) + for(val q <- Q) { + for(val i <- default(q)) { //@todo: OR + x += i } } - x.makeImmutable; + x.toImmutable; } override def toString() = { diff --git a/src/library/scala/util/automata/SubsetConstruction.scala b/src/library/scala/util/automata/SubsetConstruction.scala index ddf122dbe3..6589bf5be8 100644 --- a/src/library/scala/util/automata/SubsetConstruction.scala +++ b/src/library/scala/util/automata/SubsetConstruction.scala @@ -11,22 +11,17 @@ class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) { /** the set {0} */ final val _initialBitSet = { val rbs = new mutable.BitSet(1); - rbs.set(0); - rbs.makeImmutable; + rbs += 0; + rbs.toImmutable; } /** the set {} */ - final val _sinkBitSet = { - new mutable.BitSet(1).makeImmutable; - } + final val _sinkBitSet = new mutable.BitSet(1).toImmutable; - final val _emptyBitSet = { - val rbs = new scala.collection.mutable.BitSet(1); - new BitSet(rbs); - } + final val _emptyBitSet = new scala.collection.mutable.BitSet(1).toImmutable; def selectTag(Q:BitSet, finals:Array[Int]) = { - val it = Q.toSet(true).elements; + val it = Q.elements; var mintag = scala.runtime.compat.Math.MAX_INT; while(it.hasNext) { val tag = finals(it.next); diff --git a/src/library/scala/util/automata/WordBerrySethi.scala b/src/library/scala/util/automata/WordBerrySethi.scala index f361b6b174..fd774cc71c 100644 --- a/src/library/scala/util/automata/WordBerrySethi.scala +++ b/src/library/scala/util/automata/WordBerrySethi.scala @@ -215,8 +215,8 @@ abstract class WordBerrySethi extends BaseBerrySethi { val trans = delta1(k); val x = new mutable.BitSet(pos); for(val q <- trans(lab)) - x.set(q); - hmap.update(lab, x.makeImmutable); + x += q; + hmap.update(lab, x.toImmutable); } deltaArr(k) = hmap; k = k + 1; @@ -227,8 +227,8 @@ abstract class WordBerrySethi extends BaseBerrySethi { var k = 0; while(k < pos) { val x = new mutable.BitSet(pos); for(val q <- defaultq(k)) - x.set(q); - defaultArr(k) = x.makeImmutable; + x += q; + defaultArr(k) = x.toImmutable; k = k + 1; } } diff --git a/src/library/scala/xml/dtd/ElementValidator.scala b/src/library/scala/xml/dtd/ElementValidator.scala index 52ba82cb54..c81559a32e 100644 --- a/src/library/scala/xml/dtd/ElementValidator.scala +++ b/src/library/scala/xml/dtd/ElementValidator.scala @@ -63,7 +63,7 @@ class ElementValidator() extends Function1[Node,Boolean] { var attr: AttrDecl = null; val jt = adecls.elements; while(j < adecls.length) { jt.next match { - case a @ AttrDecl(Key, _, _) => attr = a; ok.set(j); j = adecls.length; + case a @ AttrDecl(Key, _, _) => attr = a; ok += j; j = adecls.length; case _ => j = j + 1; } } @@ -89,7 +89,7 @@ class ElementValidator() extends Function1[Node,Boolean] { } //Console.println("so far:"+(exc.length == len)); - val missing = ok.toSet( false ); + //val missing = ok.toSet( false ); FIXME: it doesn't seem to be used anywhere j = 0; var kt = adecls.elements; while(kt.hasNext) { kt.next match { case AttrDecl(key, tpe, REQUIRED) if !ok(j) => |