Ejemplo n.º 1
0
        // PREFIX

        internal static AddedAndRemoved IndexUpdatesForRangeSeekByPrefix(ReadableTransactionState txState, IndexDescriptor descriptor, TextValue prefix, IndexOrder indexOrder)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.NavigableMap<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> sortedUpdates = txState.getSortedIndexUpdates(descriptor.schema());
            NavigableMap <ValueTuple, ? extends LongDiffSets> sortedUpdates = txState.GetSortedIndexUpdates(descriptor.Schema());

            if (sortedUpdates == null)
            {
                return(_emptyAddedAndRemoved);
            }
            ValueTuple floor = ValueTuple.of(prefix);

            MutableLongList added   = LongLists.mutable.empty();
            MutableLongSet  removed = LongSets.mutable.empty();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (java.util.Map.Entry<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> entry : sortedUpdates.subMap(floor, MAX_STRING_TUPLE).entrySet())
            foreach (KeyValuePair <ValueTuple, ? extends LongDiffSets> entry in sortedUpdates.subMap(floor, _maxStringTuple).entrySet())
            {
                ValueTuple key = entry.Key;
                if ((( TextValue )key.OnlyValue).startsWith(prefix))
                {
                    LongDiffSets diffSets = entry.Value;
                    added.addAll(diffSets.Added);
                    removed.addAll(diffSets.Removed);
                }
                else
                {
                    break;
                }
            }
            return(new AddedAndRemoved(indexOrder == IndexOrder.DESCENDING ? added.asReversed() : added, removed));
        }
Ejemplo n.º 2
0
        // HELPERS

        private static AddedAndRemoved IndexUpdatesForScanAndFilter(ReadableTransactionState txState, IndexDescriptor descriptor, IndexQuery filter, IndexOrder indexOrder)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> updates = getUpdates(txState, descriptor, indexOrder);
            IDictionary <ValueTuple, ? extends LongDiffSets> updates = GetUpdates(txState, descriptor, indexOrder);

            if (updates == null)
            {
                return(_emptyAddedAndRemoved);
            }

            MutableLongList added   = LongLists.mutable.empty();
            MutableLongSet  removed = LongSets.mutable.empty();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (java.util.Map.Entry<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> entry : updates.entrySet())
            foreach (KeyValuePair <ValueTuple, ? extends LongDiffSets> entry in updates.SetOfKeyValuePairs())
            {
                ValueTuple key = entry.Key;
                if (filter == null || filter.AcceptsValue(key.OnlyValue))
                {
                    LongDiffSets diffSet = entry.Value;
                    added.addAll(diffSet.Added);
                    removed.addAll(diffSet.Removed);
                }
            }
            return(new AddedAndRemoved(indexOrder == IndexOrder.DESCENDING ? added.asReversed() : added, removed));
        }
Ejemplo n.º 3
0
        // RANGE SEEK

        internal static AddedAndRemoved IndexUpdatesForRangeSeek <T1>(ReadableTransactionState txState, IndexDescriptor descriptor, IndexQuery.RangePredicate <T1> predicate, IndexOrder indexOrder)
        {
            Value lower = predicate.FromValue();
            Value upper = predicate.ToValue();

            if (lower == null || upper == null)
            {
                throw new System.InvalidOperationException("Use Values.NO_VALUE to encode the lack of a bound");
            }

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.NavigableMap<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> sortedUpdates = txState.getSortedIndexUpdates(descriptor.schema());
            NavigableMap <ValueTuple, ? extends LongDiffSets> sortedUpdates = txState.GetSortedIndexUpdates(descriptor.Schema());

            if (sortedUpdates == null)
            {
                return(_emptyAddedAndRemoved);
            }

            ValueTuple selectedLower;
            bool       selectedIncludeLower;

            ValueTuple selectedUpper;
            bool       selectedIncludeUpper;

            if (lower == NO_VALUE)
            {
                selectedLower        = ValueTuple.of(Values.minValue(predicate.ValueGroup(), upper));
                selectedIncludeLower = true;
            }
            else
            {
                selectedLower        = ValueTuple.of(lower);
                selectedIncludeLower = predicate.FromInclusive();
            }

            if (upper == NO_VALUE)
            {
                selectedUpper        = ValueTuple.of(Values.maxValue(predicate.ValueGroup(), lower));
                selectedIncludeUpper = false;
            }
            else
            {
                selectedUpper        = ValueTuple.of(upper);
                selectedIncludeUpper = predicate.ToInclusive();
            }

            MutableLongList added   = LongLists.mutable.empty();
            MutableLongSet  removed = LongSets.mutable.empty();

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> inRange = sortedUpdates.subMap(selectedLower, selectedIncludeLower, selectedUpper, selectedIncludeUpper);
            IDictionary <ValueTuple, ? extends LongDiffSets> inRange = sortedUpdates.subMap(selectedLower, selectedIncludeLower, selectedUpper, selectedIncludeUpper);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (java.util.Map.Entry<org.neo4j.values.storable.ValueTuple,? extends org.neo4j.storageengine.api.txstate.LongDiffSets> entry : inRange.entrySet())
            foreach (KeyValuePair <ValueTuple, ? extends LongDiffSets> entry in inRange.SetOfKeyValuePairs())
            {
                ValueTuple   values = entry.Key;
                LongDiffSets diffForSpecificValue = entry.Value;

                // The TreeMap cannot perfectly order multi-dimensional types (spatial) and need additional filtering out false positives
                // TODO: If the composite index starts to be able to handle spatial types the line below needs enhancement
                if (predicate.RegularOrder || predicate.AcceptsValue(values.OnlyValue))
                {
                    added.addAll(diffForSpecificValue.Added);
                    removed.addAll(diffForSpecificValue.Removed);
                }
            }
            return(new AddedAndRemoved(indexOrder == IndexOrder.DESCENDING ? added.asReversed() : added, removed));
        }