Example #1
0
        private void AssertRanges(
            object[][] ranges,
            QueryGraphValueForge value)
        {
            Assert.AreEqual(ranges.Length, value.Items.Count);

            var count = -1;
            foreach (var desc in value.Items)
            {
                count++;
                var r = (QueryGraphValueEntryRangeForge) desc.Entry;

                Assert.AreEqual(ranges[count][3], r.Type);
                Assert.AreEqual(ranges[count][4], ExprNodeUtilityPrint.ToExpressionStringMinPrecedenceSafe(desc.IndexExprs[0]));

                if (r is QueryGraphValueEntryRangeRelOpForge)
                {
                    var relOp = (QueryGraphValueEntryRangeRelOpForge) r;
                    Assert.AreEqual(ranges[count][0], GetProp(relOp.Expression));
                }
                else
                {
                    var rangeIn = (QueryGraphValueEntryRangeInForge) r;
                    Assert.AreEqual(ranges[count][1], GetProp(rangeIn.ExprStart));
                    Assert.AreEqual(ranges[count][2], GetProp(rangeIn.ExprEnd));
                }
            }
        }
Example #2
0
        public void TestNoDup()
        {
            var value = new QueryGraphValueForge();
            value.AddRelOp(MakeIdent("B"), QueryGraphRangeEnum.LESS_OR_EQUAL, MakeIdent("A"), false);
            value.AddRelOp(MakeIdent("B"), QueryGraphRangeEnum.LESS_OR_EQUAL, MakeIdent("A"), false);
            AssertRanges(new[] { new object[] { "B", null, null, QueryGraphRangeEnum.LESS_OR_EQUAL, "A" } }, value);

            value = new QueryGraphValueForge();
            value.AddRange(QueryGraphRangeEnum.RANGE_CLOSED, MakeIdent("B"), MakeIdent("C"), MakeIdent("A"));
            value.AddRange(QueryGraphRangeEnum.RANGE_CLOSED, MakeIdent("B"), MakeIdent("C"), MakeIdent("A"));
            AssertRanges(new[] { new object[] { null, "B", "C", QueryGraphRangeEnum.RANGE_CLOSED, "A" } }, value);
        }
Example #3
0
        private QueryGraphValueForge GetCreateValue(
            int streamKey,
            int streamValue)
        {
            Check(streamValue, streamKey);
            var key = new QueryGraphKey(streamKey, streamValue);
            var value = streamJoinMap.Get(key);
            if (value == null) {
                value = new QueryGraphValueForge();
                streamJoinMap.Put(key, value);
            }

            return value;
        }
Example #4
0
        private void TryAdd(
            string propertyKeyOne,
            QueryGraphRangeEnum opOne,
            ExprIdentNode valueOne,
            string propertyKeyTwo,
            QueryGraphRangeEnum opTwo,
            ExprIdentNode valueTwo,
            object[][] expected)
        {
            var value = new QueryGraphValueForge();
            value.AddRelOp(MakeIdent(propertyKeyOne), opOne, valueOne, true);
            value.AddRelOp(MakeIdent(propertyKeyTwo), opTwo, valueTwo, true);
            AssertRanges(expected, value);

            value = new QueryGraphValueForge();
            value.AddRelOp(MakeIdent(propertyKeyTwo), opTwo, valueTwo, true);
            value.AddRelOp(MakeIdent(propertyKeyOne), opOne, valueOne, true);
            AssertRanges(expected, value);
        }