src/Pure/General/graph.scala
changeset 46623 bce24d3f29e7
parent 46615 c29bf6741ace
child 46659 b257053a4cbe
equal deleted inserted replaced
46622:3ccecb301d4e 46623:bce24d3f29e7
    15 {
    15 {
    16   class Duplicate[Key](x: Key) extends Exception
    16   class Duplicate[Key](x: Key) extends Exception
    17   class Undefined[Key](x: Key) extends Exception
    17   class Undefined[Key](x: Key) extends Exception
    18   class Cycles[Key](cycles: List[List[Key]]) extends Exception
    18   class Cycles[Key](cycles: List[List[Key]]) extends Exception
    19 
    19 
    20   def empty[Key, A]: Graph[Key, A] = new Graph[Key, A](Map.empty)
    20   private val empty_val: Graph[Any, Nothing] = new Graph[Any, Nothing](Map.empty)
       
    21   def empty[Key, A]: Graph[Key, A] = empty_val.asInstanceOf[Graph[Key, A]]
    21 }
    22 }
    22 
    23 
    23 
    24 
    24 class Graph[Key, A] private(rep: Map[Key, (A, (Set[Key], Set[Key]))])
    25 class Graph[Key, A] private(rep: Map[Key, (A, (Set[Key], Set[Key]))])
    25   extends Iterable[(Key, (A, (Set[Key], Set[Key])))]
    26   extends Iterable[(Key, (A, (Set[Key], Set[Key])))]