Last active
August 29, 2015 14:26
-
-
Save jeroenr/c926dffc951631465baa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ~>[Out](junction: UniformFanInShape[T, Out])(implicit b: Builder[_]): PortOps[Out, Unit] = { | |
def bind(n: Int): Unit = { | |
if (n == junction.inSeq.length) | |
throw new IllegalArgumentException(s"no more inlets free on $junction") | |
else if (b.module.upstreams.contains(junction.in(n))) bind(n + 1) // it's already part of the graph | |
else b.addEdge(importAndGetPort(b), junction.in(n)) // b.add(), add it to the graph | |
} | |
bind(0) | |
junction.out | |
} | |
def ~>[Out](junction: UniformFanOutShape[T, Out])(implicit b: Builder[_]): PortOps[Out, Unit] = { | |
// b.add(), add it to the graph | |
b.addEdge(importAndGetPort(b), junction.in) | |
try findOut(b, junction, 0) | |
catch { | |
case e: IllegalArgumentException ⇒ new DisabledPortOps(e.getMessage) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment