aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAlbert Magyar2017-11-16 18:32:32 -0800
committerGitHub2017-11-16 18:32:32 -0800
commit50a3641dd9700c1899198f13bc1362db78e25b79 (patch)
tree38ba90d612b5cd7ef99d0f27f85fd370852c569e /src/main
parent4429e2112aa958acab2ab43b0bf1d4c43becb50e (diff)
Move digraph exceptions out of digraph class (#688)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/firrtl/graph/DiGraph.scala15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/main/scala/firrtl/graph/DiGraph.scala b/src/main/scala/firrtl/graph/DiGraph.scala
index 3a657cc0..7e56919c 100644
--- a/src/main/scala/firrtl/graph/DiGraph.scala
+++ b/src/main/scala/firrtl/graph/DiGraph.scala
@@ -4,7 +4,13 @@ import scala.collection.{Set, Map}
import scala.collection.mutable
import scala.collection.mutable.{LinkedHashSet, LinkedHashMap}
-/** A companion to create immutable DiGraphs from mutable data */
+/** An exception that is raised when an assumed DAG has a cycle */
+class CyclicException extends Exception("No valid linearization for cyclic graph")
+
+/** An exception that is raised when attempting to find an unreachable node */
+class PathNotFoundException extends Exception("Unreachable node")
+
+/** A companion to create DiGraphs from mutable data */
object DiGraph {
/** Create a DiGraph from a MutableDigraph, representing the same graph */
def apply[T](mdg: MutableDiGraph[T]): DiGraph[T] = mdg
@@ -27,13 +33,6 @@ object DiGraph {
/** Represents common behavior of all directed graphs */
class DiGraph[T] private[graph] (private[graph] val edges: LinkedHashMap[T, LinkedHashSet[T]]) {
-
- /** An exception that is raised when an assumed DAG has a cycle */
- class CyclicException extends Exception("No valid linearization for cyclic graph")
- /** An exception that is raised when attempting to find an unreachable node */
- class PathNotFoundException extends Exception("Unreachable node")
-
-
/** Check whether the graph contains vertex v */
def contains(v: T): Boolean = edges.contains(v)