コード例 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyRandomRanges(org.neo4j.values.storable.ValueType[] types, java.util.TreeSet<ValueAndId> sortedValues) throws Exception
            internal virtual void VerifyRandomRanges(ValueType[] types, SortedSet <ValueAndId> sortedValues)
            {
                for (int i = 0; i < 100; i++)
                {
                    Value     booleanValue = Random.randomValues().nextBooleanValue();
                    ValueType type         = Random.among(types);
                    Value     from         = Random.randomValues().nextValueOfType(type);
                    Value     to           = Random.randomValues().nextValueOfType(type);
                    if (Values.COMPARATOR.Compare(from, to) > 0)
                    {
                        Value tmp = from;
                        from = to;
                        to   = tmp;
                    }
                    bool fromInclusive = Random.nextBoolean();
                    bool toInclusive   = Random.nextBoolean();

                    // when
                    IList <long> expectedIds = expectedIds(sortedValues, booleanValue, from, to, fromInclusive, toInclusive);

                    // Depending on order capabilities we verify ids or order and ids.
                    IndexQuery[]    predicates      = new IndexQuery[] { IndexQuery.exact(100, booleanValue), IndexQuery.range(101, from, fromInclusive, to, toInclusive) };
                    ValueCategory[] valueCategories = GetValueCategories(predicates);
                    IndexOrder[]    indexOrders     = IndexProvider.getCapability(Descriptor).orderCapability(valueCategories);
                    foreach (IndexOrder order in indexOrders)
                    {
                        IList <long> actualIds = AssertInOrder(order, predicates);
                        actualIds.sort(long?.compare);
                        // then
                        assertThat(actualIds, equalTo(expectedIds));
                    }
                }
            }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void verifyRandomRanges(org.neo4j.values.storable.ValueType[] types, java.util.TreeSet<ValueAndId> sortedValues) throws Exception
        private void VerifyRandomRanges(ValueType[] types, SortedSet <ValueAndId> sortedValues)
        {
            for (int i = 0; i < 100; i++)
            {
                // Construct a random range query of random value type
                ValueType type = Random.among(types);
                Value     from = Random.randomValues().nextValueOfType(type);
                Value     to   = Random.randomValues().nextValueOfType(type);
                if (Values.COMPARATOR.Compare(from, to) > 0)
                {
                    Value tmp = from;
                    from = to;
                    to   = tmp;
                }
                bool fromInclusive = Random.nextBoolean();
                bool toInclusive   = Random.nextBoolean();

                // Expected result based on query
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.internal.kernel.api.IndexQuery.RangePredicate<?> predicate = org.neo4j.internal.kernel.api.IndexQuery.range(0, from, fromInclusive, to, toInclusive);
                IndexQuery.RangePredicate <object> predicate = IndexQuery.range(0, from, fromInclusive, to, toInclusive);
                IList <long> expectedIds = expectedIds(sortedValues, from, to, fromInclusive, toInclusive);

                // Depending on order capabilities we verify ids or order and ids.
                IndexOrder[] indexOrders = IndexProvider.getCapability(Descriptor).orderCapability(predicate.ValueGroup().category());
                foreach (IndexOrder order in indexOrders)
                {
                    IList <long> actualIds = AssertInOrder(order, predicate);
                    actualIds.sort(long?.compare);
                    // then
                    assertThat(actualIds, equalTo(expectedIds));
                }
            }
        }
コード例 #3
0
 internal virtual IndexOrder[] OrderCapability(params IndexQuery[] predicates)
 {
     ValueCategory[] categories = new ValueCategory[predicates.Length];
     for (int i = 0; i < predicates.Length; i++)
     {
         categories[i] = predicates[i].ValueGroup().category();
     }
     return(IndexProvider.getCapability(Descriptor).orderCapability(categories));
 }