private static ISet <int> GetInnerStreams( int fromStream, IEnumerable <int> toStreams, OuterInnerDirectionalGraph outerInnerGraph, InnerJoinGraph innerJoinGraph, ISet <int> completedStreams) { ISet <int> innerStreams = new HashSet <int>(); foreach (int toStream in toStreams) { if (outerInnerGraph.IsInner(fromStream, toStream)) { // if the to-stream, recursively, has an inner join itself, it becomes a required stream and not optional var hasInnerJoin = false; if (!innerJoinGraph.IsEmpty()) { var doNotUseStreams = new HashSet <int>(completedStreams); completedStreams.Add(fromStream); hasInnerJoin = RecursiveHasInnerJoin(toStream, outerInnerGraph, innerJoinGraph, doNotUseStreams); } if (!hasInnerJoin) { innerStreams.Add(toStream); } } } return(innerStreams); }
public void TestIsInner() { graph.Add(0, 1); Assert.IsTrue(graph.IsInner(0, 1)); Assert.IsFalse(graph.IsInner(1, 0)); Assert.IsFalse(graph.IsInner(2, 0)); Assert.IsFalse(graph.IsInner(0, 2)); graph.Add(1, 0); Assert.IsTrue(graph.IsInner(0, 1)); Assert.IsTrue(graph.IsInner(1, 0)); graph.Add(2, 0); Assert.IsTrue(graph.IsInner(2, 0)); Assert.IsFalse(graph.IsInner(0, 2)); TryInvalidIsInner(4, 0); TryInvalidIsInner(0, 4); TryInvalidIsInner(1, 1); TryInvalidIsInner(1, -1); TryInvalidIsInner(-1, 1); }