示例#1
0
 private void AssertInners(int[][] innersPerStream, OuterInnerDirectionalGraph graph)
 {
     for (var i = 0; i < innersPerStream.Length; i++)
     {
         EPAssertionUtil.AssertEqualsAnyOrder(innersPerStream[i], graph.GetInner(i));
     }
 }
示例#2
0
        private static bool RecursiveHasInnerJoin(
            int toStream,
            OuterInnerDirectionalGraph outerInnerGraph,
            InnerJoinGraph innerJoinGraph,
            ICollection <int> completedStreams)
        {
            // Check if the to-stream is in any of the inner joins
            var hasInnerJoin = innerJoinGraph.HasInnerJoin(toStream);

            if (hasInnerJoin)
            {
                return(true);
            }

            var innerToToStream = outerInnerGraph.GetInner(toStream);

            if (innerToToStream != null)
            {
                foreach (int nextStream in innerToToStream)
                {
                    if (completedStreams.Contains(nextStream))
                    {
                        continue;
                    }

                    var notConsider = new HashSet <int>(completedStreams);
                    notConsider.Add(toStream);
                    var result = RecursiveHasInnerJoin(nextStream, outerInnerGraph, innerJoinGraph, notConsider);

                    if (result)
                    {
                        return(true);
                    }
                }
            }

            var outerToToStream = outerInnerGraph.GetOuter(toStream);

            if (outerToToStream != null)
            {
                foreach (int nextStream in outerToToStream)
                {
                    if (completedStreams.Contains(nextStream))
                    {
                        continue;
                    }

                    var notConsider = new HashSet <int>(completedStreams);
                    notConsider.Add(toStream);
                    var result = RecursiveHasInnerJoin(nextStream, outerInnerGraph, innerJoinGraph, notConsider);

                    if (result)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        public void TestGetInner()
        {
            TryInvalidGetInner(4);
            TryInvalidGetInner(-1);

            Assert.IsNull(graph.GetInner(0));

            graph.Add(0, 1);
            Assert.IsNull(graph.GetInner(1));
            EPAssertionUtil.AssertEqualsAnyOrder(new int[] { 1 }, graph.GetInner(0));
            graph.Add(0, 3);
            EPAssertionUtil.AssertEqualsAnyOrder(new int[] { 1, 3 }, graph.GetInner(0));
            graph.Add(1, 0);
            EPAssertionUtil.AssertEqualsAnyOrder(new int[] { 0 }, graph.GetInner(1));
            graph.Add(1, 2);
            graph.Add(1, 3);
            EPAssertionUtil.AssertEqualsAnyOrder(new int[] { 0, 2, 3 }, graph.GetInner(1));
        }