Пример #1
0
        private IList <NodeWithPropertyValues> Process(SortedMergeJoin sortedMergeJoin, IEnumerator <NodeWithPropertyValues> iteratorA, IEnumerator <NodeWithPropertyValues> iteratorB)
        {
            Collector collector = new Collector(this);

            while (!collector.Done)
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                if (iteratorA.hasNext() && sortedMergeJoin.NeedsA())
                {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    NodeWithPropertyValues a = iteratorA.next();
                    sortedMergeJoin.SetA(a.NodeId, a.Values);
                }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                if (iteratorB.hasNext() && sortedMergeJoin.NeedsB())
                {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    NodeWithPropertyValues b = iteratorB.next();
                    sortedMergeJoin.SetB(b.NodeId, b.Values);
                }

                sortedMergeJoin.Next(collector);
            }
            return(collector.Result);
        }
Пример #2
0
        private void AssertThatItWorksOneWay(IList <NodeWithPropertyValues> listA, IList <NodeWithPropertyValues> listB)
        {
            SortedMergeJoin sortedMergeJoin = new SortedMergeJoin();

            sortedMergeJoin.Initialize(IndexOrder);

            IComparer <NodeWithPropertyValues> comparator = IndexOrder == IndexOrder.ASCENDING ? (a, b) => ValueTuple.COMPARATOR.Compare(ValueTuple.of(a.Values), ValueTuple.of(b.Values)) : (a, b) => ValueTuple.COMPARATOR.Compare(ValueTuple.of(b.Values), ValueTuple.of(a.Values));

            listA.sort(comparator);
            listB.sort(comparator);

            IList <NodeWithPropertyValues> result = Process(sortedMergeJoin, listA.GetEnumerator(), listB.GetEnumerator());

            IList <NodeWithPropertyValues> expected = new List <NodeWithPropertyValues>();

            ((IList <NodeWithPropertyValues>)expected).AddRange(listA);
            ((IList <NodeWithPropertyValues>)expected).AddRange(listB);
            expected.sort(comparator);

            assertThat(result, equalTo(expected));
        }