                   (transform %))
             transitions)
        (apply concat)))
-
-(defn- get-component-unit [{:keys [ruleset] :as router} component]
-  (-> (:units ruleset)
-      owc/map-invert-coll
-      (get component)))
-
-(defn- get-tunnel [{:keys [unit] :as router} component]
-  (and unit
-       (let [cunit (get-component-unit router component)]
-         (and (not= unit cunit)
-              cunit))))
 
 (defn- handle-events [eventhandlers msg]
   (reduce (fn [s [key eventhandler]]

    (do (warn "dropping message due to high transition-count")
        [])))

(defn make-router [ruleset components & {:keys [unit dispatch?]
                                         :or {dispatch? true}}]
  {:unit unit
   :components components
   :ruleset ruleset
   :dispatch? dispatch?})

#_(defrecord MessageRouter [ruleset]

  p/Router

  (advance [this msg]
    (advance ruleset msg)))

#_(defn message-router [ruleset]
  (->MessageRouter ruleset))

(defn message [route map & {:keys [max-transitions]
                            :or {max-transitions 100}}]

         ::transition-count 0
         ::max-transitions max-transitions))

(defn make-router [ruleset components & {:keys [unit dispatch?]
                                         :or {dispatch? true}}]
  {:unit unit
   :components components
   :ruleset ruleset
   :dispatch? dispatch?})


#_(defn- process [this req]
  (advance req (:ruleset this)))
