8 |
8 |
9 package isabelle |
9 package isabelle |
10 |
10 |
11 |
11 |
12 import scala.collection.SetLike |
12 import scala.collection.SetLike |
13 import scala.collection.generic.{ImmutableSetFactory, CanBuildFrom, |
13 import scala.collection.generic.{SetFactory, CanBuildFrom, GenericSetTemplate, GenericCompanion} |
14 GenericSetTemplate, GenericCompanion} |
14 import scala.collection.mutable.{Builder, SetBuilder} |
|
15 import scala.language.higherKinds |
15 |
16 |
16 |
17 |
17 object Linear_Set extends ImmutableSetFactory[Linear_Set] |
18 object Linear_Set extends SetFactory[Linear_Set] |
18 { |
19 { |
19 private val empty_val: Linear_Set[Nothing] = new Linear_Set[Nothing](None, None, Map(), Map()) |
20 private val empty_val: Linear_Set[Nothing] = new Linear_Set[Nothing](None, None, Map(), Map()) |
20 override def empty[A] = empty_val.asInstanceOf[Linear_Set[A]] |
21 override def empty[A] = empty_val.asInstanceOf[Linear_Set[A]] |
21 |
22 |
22 implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Linear_Set[A]] = setCanBuildFrom[A] |
23 implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Linear_Set[A]] = setCanBuildFrom[A] |
|
24 def newBuilder[A]: Builder[A, Linear_Set[A]] = new SetBuilder[A, Linear_Set[A]](empty[A]) |
23 |
25 |
24 class Duplicate[A](x: A) extends Exception |
26 class Duplicate[A](x: A) extends Exception |
25 class Undefined[A](x: A) extends Exception |
27 class Undefined[A](x: A) extends Exception |
26 class Next_Undefined[A](x: Option[A]) extends Exception |
28 class Next_Undefined[A](x: Option[A]) extends Exception |
27 } |
29 } |