private void CollectNodes(MutableLongSet bucket, ResourceIterator <Node> toCollect)
 {
     while (toCollect.MoveNext())
     {
         bucket.add(toCollect.Current.Id);
     }
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldConsiderNodesChangedInSameTxInIndexSeek()
        public virtual void ShouldConsiderNodesChangedInSameTxInIndexSeek()
        {
            // GIVEN
            CreateNodes(_db, _label, NonMatching[0]);
            LongSet        toChangeToMatch    = CreateNodes(_db, _label, NonMatching[1]);
            LongSet        toChangeToNotMatch = CreateNodes(_db, _label, Values);
            MutableLongSet expected           = CreateNodes(_db, _label, Values);
            // WHEN
            MutableLongSet found = new LongHashSet();

            using (Transaction tx = _db.beginTx())
            {
                LongIterator toMatching = toChangeToMatch.longIterator();
                while (toMatching.hasNext())
                {
                    long id = toMatching.next();
                    SetProperties(id, Values);
                    expected.add(id);
                }
                LongIterator toNotMatching = toChangeToNotMatch.longIterator();
                while (toNotMatching.hasNext())
                {
                    long id = toNotMatching.next();
                    SetProperties(id, NonMatching[2]);
                    expected.remove(id);
                }

                CollectNodes(found, IndexSeek.findNodes(Keys, Values, _db));
            }
            // THEN
            assertThat(found, equalTo(expected));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldConsiderNodesChangedInSameTxInIndexSeek()
        public virtual void ShouldConsiderNodesChangedInSameTxInIndexSeek()
        {
            // GIVEN
            CreateNodes(_db, _label, _nonMatching[0]);
            LongSet        toChangeToMatch    = CreateNodes(_db, _label, _nonMatching[1]);
            MutableLongSet toChangeToNotMatch = CreateNodes(_db, _label, _matching[0]);
            MutableLongSet expected           = CreateNodes(_db, _label, _matching[1]);
            // WHEN
            MutableLongSet found = new LongHashSet();

            using (Transaction tx = _db.beginTx())
            {
                LongIterator toMatching = toChangeToMatch.longIterator();
                while (toMatching.hasNext())
                {
                    long id = toMatching.next();
                    _db.getNodeById(id).setProperty(_key, _matching[2]);
                    expected.add(id);
                }
                LongIterator toNotMatching = toChangeToNotMatch.longIterator();
                while (toNotMatching.hasNext())
                {
                    long id = toNotMatching.next();
                    _db.getNodeById(id).setProperty(_key, _nonMatching[2]);
                    expected.remove(id);
                }

                CollectNodes(found, _db.findNodes(_label, _key, _template, _searchMode));
            }
            // THEN
            assertThat(found, equalTo(expected));
        }
 public override void VisitNodeLabelChanges(long id, LongSet added, LongSet removed)
 {
     IndexNode(id);
     if (_visitingNodes)
     {
         // Nodes that have had their indexed labels removed will not have their properties indexed, so 'indexNode' would skip them.
         // However, we still need to make sure that they are not included in the result from the base index reader.
         foreach (int entityTokenId in _entityTokenIds)
         {
             if (removed.contains(entityTokenId))
             {
                 _modifiedEntityIdsInThisTransaction.add(id);
                 break;
             }
         }
     }
 }
Exemple #5
0
        private MutableLong UniqueKey(MutableLongSet uniqueKeys)
        {
            MutableLong key;

            do
            {
                key = new MutableLong(Random.nextLong(10_000_000));
            } while (!uniqueKeys.add(key.longValue()));
            return(key);
        }
        public virtual void AddRelationship(long relId, int typeId, RelationshipDirection direction)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.map.primitive.MutableIntObjectMap<org.eclipse.collections.api.set.primitive.MutableLongSet> relTypeToRelsMap = getTypeToRelMapForDirection(direction);
            MutableIntObjectMap <MutableLongSet> relTypeToRelsMap = GetTypeToRelMapForDirection(direction);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableLongSet rels = relTypeToRelsMap.getIfAbsentPut(typeId, org.eclipse.collections.impl.set.mutable.primitive.LongHashSet::new);
//JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter:
            MutableLongSet rels = relTypeToRelsMap.getIfAbsentPut(typeId, LongHashSet::new);

            rels.add(relId);
        }
Exemple #7
0
 public override bool Remove(long elem)
 {
     if (IsAdded(elem) && base.Remove(elem))
     {
         if (RemovedFromAdded == null)
         {
             RemovedFromAdded = outerInstance.collectionsFactory.NewLongSet();
         }
         RemovedFromAdded.add(elem);
         return(true);
     }
     return(base.Remove(elem));
 }
Exemple #8
0
 internal virtual void RemoveProperty(int propertyKeyId)
 {
     if (_addedProperties != null && _addedProperties.remove(propertyKeyId) != null)
     {
         return;
     }
     if (_removedProperties == null)
     {
         _removedProperties = CollectionsFactory.newLongSet();
     }
     _removedProperties.add(propertyKeyId);
     if (_changedProperties != null)
     {
         _changedProperties.remove(propertyKeyId);
     }
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncludeNodesCreatedInSameTxInIndexSeek()
        public virtual void ShouldIncludeNodesCreatedInSameTxInIndexSeek()
        {
            // GIVEN
            CreateNodes(_db, _label, _nonMatching[0], _nonMatching[1]);
            MutableLongSet expected = CreateNodes(_db, _label, _matching[0], _matching[1]);
            // WHEN
            MutableLongSet found = new LongHashSet();

            using (Transaction tx = _db.beginTx())
            {
                expected.add(CreateNode(_db, map(_key, _matching[2]), _label).Id);
                CreateNode(_db, map(_key, _nonMatching[2]), _label);

                CollectNodes(found, _db.findNodes(_label, _key, _template, _searchMode));
            }
            // THEN
            assertThat(found, equalTo(expected));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldIncludeNodesCreatedInSameTxInIndexSeek()
        public virtual void ShouldIncludeNodesCreatedInSameTxInIndexSeek()
        {
            // GIVEN
            CreateNodes(_db, _label, NonMatching[0], NonMatching[1]);
            MutableLongSet expected = CreateNodes(_db, _label, Values);
            // WHEN
            MutableLongSet found = new LongHashSet();

            using (Transaction tx = _db.beginTx())
            {
                expected.add(CreateNode(_db, PropertyMap(Keys, Values), _label).Id);
                CreateNode(_db, PropertyMap(Keys, NonMatching[2]), _label);

                CollectNodes(found, IndexSeek.findNodes(Keys, Values, _db));
            }
            // THEN
            assertThat(found, equalTo(expected));
        }
 public override void Accept(long?newValue)
 {
     assertTrue(Values.add(newValue), format("Value %d was seen twice", newValue));
 }
 public void acquiredFreelistPageId(long freelistPageId)
 {
     _expected.add(freelistPageId);
 }