summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormihaylov <mihaylov@epfl.ch>2006-01-26 17:33:39 +0000
committermihaylov <mihaylov@epfl.ch>2006-01-26 17:33:39 +0000
commitc57219d240fd3188bf1c4c2edd7af9c3d31c18ce (patch)
treec6846ed234039b3183f43a4676b501a6e92be6b9 /src
parenta5cffcb68756539a66ca9d604f79bb6cbe93b313 (diff)
downloadscala-c57219d240fd3188bf1c4c2edd7af9c3d31c18ce.tar.gz
scala-c57219d240fd3188bf1c4c2edd7af9c3d31c18ce.tar.bz2
scala-c57219d240fd3188bf1c4c2edd7af9c3d31c18ce.zip
Move the implicit BitSet=>Ordered[BitSet] coerc...
Move the implicit BitSet=>Ordered[BitSet] coercion to automata/SubsetConstruction, where it is used
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/immutable/BitSet.scala33
-rw-r--r--src/library/scala/util/automata/SubsetConstruction.scala32
2 files changed, 31 insertions, 34 deletions
diff --git a/src/library/scala/collection/immutable/BitSet.scala b/src/library/scala/collection/immutable/BitSet.scala
index 8e1f28b83c..cc99f4fecd 100644
--- a/src/library/scala/collection/immutable/BitSet.scala
+++ b/src/library/scala/collection/immutable/BitSet.scala
@@ -38,36 +38,3 @@ class BitSet(val size: Int, val capacity: Int, ba: Array[Int], copy: Boolean)
ba;
}
-
-object BitSet {
- implicit def toOrdered(bs: BitSet): Ordered[BitSet] = new Ordered[BitSet] {
- def compareTo [b >: BitSet <% Ordered[b]](other: b): Int = other match {
- case that: BitSet => {
- val it1 = bs.elements;
- val it2 = that.elements;
- var res = 0;
- while((0 == res) && it1.hasNext) {
- while((0 == res) && it2.hasNext) {
- if (!it1.hasNext)
- res = -1
- else {
- val i1 = it1.next;
- val i2 = it2.next;
- if (i1 < i2)
- res = -1
- else if (i1 > i2)
- res = 1
- }
- }
- if (it1.hasNext)
- res = 1
- }
- if (it2.hasNext)
- res = -1;
- res
- }
-
- //case _ => -(other.compareTo(this))
- }
- }
-}
diff --git a/src/library/scala/util/automata/SubsetConstruction.scala b/src/library/scala/util/automata/SubsetConstruction.scala
index 6589bf5be8..2c85843731 100644
--- a/src/library/scala/util/automata/SubsetConstruction.scala
+++ b/src/library/scala/util/automata/SubsetConstruction.scala
@@ -1,13 +1,43 @@
package scala.util.automata ;
class SubsetConstruction[T <: AnyRef](val nfa: NondetWordAutom[T]) {
-
//import nfa.{ _labelT, labels };
import nfa.labels ;
import scala.collection.{immutable, mutable, Map} ;
import immutable.{ BitSet, TreeMap, TreeSet } ;
+ implicit def toOrdered(bs: BitSet): Ordered[BitSet] = new Ordered[BitSet] {
+ def compareTo [b >: BitSet <% Ordered[b]](other: b): Int = other match {
+ case that: BitSet => {
+ val it1 = bs.elements;
+ val it2 = that.elements;
+ var res = 0;
+ while((0 == res) && it1.hasNext) {
+ while((0 == res) && it2.hasNext) {
+ if (!it1.hasNext)
+ res = -1
+ else {
+ val i1 = it1.next;
+ val i2 = it2.next;
+ if (i1 < i2)
+ res = -1
+ else if (i1 > i2)
+ res = 1
+ }
+ }
+ if (it1.hasNext)
+ res = 1
+ }
+ if (it2.hasNext)
+ res = -1;
+ res
+ }
+
+ //case _ => -(other.compareTo(this))
+ }
+ }
+
/** the set {0} */
final val _initialBitSet = {
val rbs = new mutable.BitSet(1);