Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustSelectCorrectTargetForAllGivenValueCombinations()
        public virtual void MustSelectCorrectTargetForAllGivenValueCombinations()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            Value[] allValues = FusionIndexTestHelp.AllValues();

            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                Value[] group = values[slot];
                foreach (Value value in group)
                {
                    // when
                    IndexProvider selected = _instanceSelector.select(_slotSelector.selectSlot(array(value), GROUP_OF));

                    // then
                    assertSame(OrLucene(_providers[slot]), selected);
                }
            }

            // All composite values should go to lucene
            foreach (Value firstValue in allValues)
            {
                foreach (Value secondValue in allValues)
                {
                    // when
                    IndexProvider selected = _instanceSelector.select(_slotSelector.selectSlot(array(firstValue, secondValue), GROUP_OF));

                    // then
                    assertSame(_providers[LUCENE], selected);
                }
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.collection.PrimitiveLongResourceIterator query(org.neo4j.internal.kernel.api.IndexQuery... predicates) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException
        public override PrimitiveLongResourceIterator Query(params IndexQuery[] predicates)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IndexSlot slot = SlotSelector.selectSlot(predicates, IndexQuery::valueGroup);

            return(slot != null?InstanceSelector.select(slot).query(predicates) : concat(InstanceSelector.transform(reader => reader.query(predicates))));
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void add(java.util.Collection<? extends org.neo4j.kernel.api.index.IndexEntryUpdate<?>> updates) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Add <T1>(ICollection <T1> updates) where T1 : Org.Neo4j.Kernel.Api.Index.IndexEntryUpdate <T1>
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: LazyInstanceSelector<java.util.Collection<org.neo4j.kernel.api.index.IndexEntryUpdate<?>>> batchSelector = new LazyInstanceSelector<>(slot -> new java.util.ArrayList<>());
            LazyInstanceSelector <ICollection <IndexEntryUpdate <object> > > batchSelector = new LazyInstanceSelector <ICollection <IndexEntryUpdate <object> > >(slot => new List <>());

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.neo4j.kernel.api.index.IndexEntryUpdate<?> update : updates)
            foreach (IndexEntryUpdate <object> update in updates)
            {
                batchSelector.Select(SlotSelector.selectSlot(update.Values(), GroupOf)).Add(update);
            }

            // Manual loop due do multiple exception types
            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Collection<org.neo4j.kernel.api.index.IndexEntryUpdate<?>> batch = batchSelector.getIfInstantiated(slot);
                ICollection <IndexEntryUpdate <object> > batch = batchSelector.GetIfInstantiated(slot);
                if (batch != null)
                {
                    this.InstanceSelector.select(slot).add(batch);
                }
            }
        }
Esempio n. 4
0
        public override bool HasFullValuePrecision(params IndexQuery[] predicates)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IndexSlot slot = SlotSelector.selectSlot(predicates, IndexQuery::valueGroup);

            if (slot != null)
            {
                return(InstanceSelector.select(slot).hasFullValuePrecision(predicates));
            }
            else
            {
                // UNKNOWN slot which basically means the EXISTS predicate
                if (!(predicates.Length == 1 && predicates[0] is IndexQuery.ExistsPredicate))
                {
                    throw new System.InvalidOperationException("Selected IndexReader null for predicates " + Arrays.ToString(predicates));
                }
                return(true);
            }
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void query(org.neo4j.storageengine.api.schema.IndexProgressor_NodeValueClient cursor, org.neo4j.internal.kernel.api.IndexOrder indexOrder, boolean needsValues, org.neo4j.internal.kernel.api.IndexQuery... predicates) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException
        public override void Query(Org.Neo4j.Storageengine.Api.schema.IndexProgressor_NodeValueClient cursor, IndexOrder indexOrder, bool needsValues, params IndexQuery[] predicates)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IndexSlot slot = SlotSelector.selectSlot(predicates, IndexQuery::valueGroup);

            if (slot != null)
            {
                InstanceSelector.select(slot).query(cursor, indexOrder, needsValues, predicates);
            }
            else
            {
                if (indexOrder != IndexOrder.NONE)
                {
                    throw new System.NotSupportedException(format("Tried to query index with unsupported order %s. Supported orders for query %s are %s.", indexOrder, Arrays.ToString(predicates), IndexOrder.NONE));
                }
                BridgingIndexProgressor multiProgressor = new BridgingIndexProgressor(cursor, _descriptor.schema().PropertyIds);
                cursor.Initialize(_descriptor, multiProgressor, predicates, indexOrder, needsValues);
                try
                {
                    InstanceSelector.forAll(reader =>
                    {
                        try
                        {
                            reader.query(multiProgressor, indexOrder, needsValues, predicates);
                        }
                        catch (IndexNotApplicableKernelException e)
                        {
                            throw new InnerException(e);
                        }
                    });
                }
                catch (InnerException e)
                {
                    throw e.InnerException;
                }
            }
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void process(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            switch (update.UpdateMode())
            {
            case ADDED:
                InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).process(update);
                break;

            case CHANGED:
                // Hmm, here's a little conundrum. What if we change from a value that goes into native
                // to a value that goes into fallback, or vice versa? We also don't want to blindly pass
                // all CHANGED updates to both updaters since not all values will work in them.
                IndexUpdater from = InstanceSelector.select(SlotSelector.selectSlot(update.BeforeValues(), GroupOf));
                IndexUpdater to   = InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf));
                // There are two cases:
                // - both before/after go into the same updater --> pass update into that updater
                if (from == to)
                {
                    from.Process(update);
                }
                // - before go into one and after into the other --> REMOVED from one and ADDED into the other
                else
                {
                    from.Process(IndexEntryUpdate.remove(update.EntityId, update.IndexKey(), update.BeforeValues()));
                    to.Process(IndexEntryUpdate.add(update.EntityId, update.IndexKey(), update.Values()));
                }
                break;

            case REMOVED:
                InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).process(update);
                break;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }
Esempio n. 7
0
 public override long CountIndexedNodes(long nodeId, int[] propertyKeyIds, params Value[] propertyValues)
 {
     return(InstanceSelector.select(SlotSelector.selectSlot(propertyValues, GroupOf)).countIndexedNodes(nodeId, propertyKeyIds, propertyValues));
 }
Esempio n. 8
0
 public override void ValidateBeforeCommit(Value[] tuple)
 {
     InstanceSelector.select(SlotSelector.selectSlot(tuple, GroupOf)).validateBeforeCommit(tuple);
 }
Esempio n. 9
0
 public override void IncludeSample <T1>(IndexEntryUpdate <T1> update)
 {
     InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).includeSample(update);
 }