Ejemplo n.º 1
0
 private void VerifyResult(LongSet results)
 {
     assertEquals(3, results.size());
     assertTrue(results.contains(1));
     assertTrue(results.contains(2));
     assertTrue(results.contains(3));
 }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void convertJavaCollectionToSetOfPrimitives()
        internal virtual void ConvertJavaCollectionToSetOfPrimitives()
        {
            IList <long> longs = new IList <long> {
                1L, 4L, 7L
            };
            LongSet longSet = PrimitiveLongCollections.AsSet(longs);

            assertTrue(longSet.contains(1L));
            assertTrue(longSet.contains(4L));
            assertTrue(longSet.contains(7L));
            assertEquals(3, longSet.size());
        }
Ejemplo n.º 3
0
        private Action BuildWriteAction(Action innerAction, LongSet forbiddenRecordIds)
        {
            int mappedFilesCount = _mappedFiles.Count;

            if (mappedFilesCount == 0)
            {
                return(innerAction);
            }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.File file = mappedFiles.get(rng.nextInt(mappedFilesCount));
            File file = _mappedFiles[_rng.Next(mappedFilesCount)];

            _filesTouched.Add(file);
            int recordId;

            do
            {
                recordId = _rng.Next(_filePageCount * _recordsPerPage);
            } while (forbiddenRecordIds.contains(recordId));
            _recordsWrittenTo[file].Add(recordId);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int pageId = recordId / recordsPerPage;
            int pageId = recordId / _recordsPerPage;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int pageOffset = (recordId % recordsPerPage) * recordFormat.getRecordSize();
            int pageOffset = (recordId % _recordsPerPage) * _recordFormat.RecordSize;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Record record = recordFormat.createRecord(file, recordId);
            Record record = _recordFormat.createRecord(file, recordId);

            return(new WriteAction(this, file, recordId, pageId, pageOffset, record, innerAction));
        }
 private bool ComputeNextFromSourceAndFilter()
 {
     while (_source.hasNext())
     {
         long value = _source.next();
         if (!_removedElements.contains(value) && !_addedElements.contains(value))
         {
             return(Next(value));
         }
     }
     TransitionToAddedElements();
     return(_phase.fetchNext(this));
 }
 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;
             }
         }
     }
 }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustCombineResultFromExistsPredicate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustCombineResultFromExistsPredicate()
        {
            // given
            IndexQuery.ExistsPredicate exists = IndexQuery.exists(PROP_KEY);
            long lastId = 0;

            foreach (IndexReader aliveReader in _aliveReaders)
            {
                when(aliveReader.Query(exists)).thenReturn(PrimitiveLongResourceCollections.iterator(null, lastId++, lastId++));
            }

            // when
            LongIterator result = _fusionIndexReader.query(exists);

            // then

            LongSet resultSet = PrimitiveLongCollections.asSet(result);

            for (long i = 0L; i < lastId; i++)
            {
                assertTrue("Expected to contain " + i + ", but was " + resultSet, resultSet.contains(i));
            }
        }
Ejemplo n.º 7
0
 protected internal override bool FetchNext()
 {
     while (_source.MoveNext())
     {
         Document doc = _source.Current;
         long     id  = IdFromDoc(doc);
         bool     documentIsFromStore = doc.getField(FullTxData.TX_STATE_KEY) == null;
         bool     idWillBeReturnedByTransactionStateInstead = documentIsFromStore && _idsModifiedInTransactionState.contains(id);
         if (_removedInTransactionState.Contains(_idCostume.setId(id)) || idWillBeReturnedByTransactionStateInstead)
         {
             // Skip this one, continue to the next
             continue;
         }
         return(Next(id));
     }
     return(EndReached());
 }
Ejemplo n.º 8
0
 private bool IsRemoved(long reference)
 {
     return(_removed.contains(reference));
 }