//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void tailBeforeHeadCorrectIteration() internal virtual void TailBeforeHeadCorrectIteration() { PrimitiveLongArrayQueue queue = CreateQueue(); for (int i = 0; i < 14; i++) { queue.Enqueue(i); } for (int i = 0; i < 10; i++) { assertEquals(i, queue.Dequeue()); } for (int i = 14; i < 24; i++) { queue.Enqueue(i); } assertEquals(14, queue.Size()); LongIterator iterator = queue.LongIterator(); for (int j = 10; j < 24; j++) { assertTrue(iterator.hasNext()); assertEquals(j, iterator.next()); } assertFalse(iterator.hasNext()); }
private void Exhaust(LongIterator iterator) { while (iterator.hasNext()) { iterator.next(); } }
public override bool Next() { if (_added != null && _added.hasNext()) { this._node = _added.next(); return(true); } else { return(InnerNext()); } }
private static LongSet Drain(LongIterator iter) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableLongSet result = new org.eclipse.collections.impl.set.mutable.primitive.LongHashSet(); MutableLongSet result = new LongHashSet(); while (iter.hasNext()) { result.add(iter.next()); } return(result); }
/// <summary> /// Store all types that was added in the transaction for the current node /// </summary> private void CheckTxStateForUpdates() { if (_read.hasTxStateWithChanges()) { NodeState nodeState = _read.txState().getNodeState(_storeCursor.OwningNode); LongIterator addedRelationships = nodeState.AddedRelationships; while (addedRelationships.hasNext()) { RelationshipState relationshipState = _read.txState().getRelationshipState(addedRelationships.next()); relationshipState.Accept((relationshipId, typeId, startNodeId, endNodeId) => _txTypes.add(typeId)); } } }
private void AssertIds(RecordIdIterator ids, params long[][] expectedIds) { foreach (long[] expectedArray in expectedIds) { LongIterator iterator = ids.NextBatch(); assertNotNull(iterator); foreach (long expectedId in expectedArray) { assertEquals(expectedId, iterator.next()); } assertFalse(iterator.hasNext()); } assertNull(ids.NextBatch()); }
protected internal override R FetchNextOrNull() { while ( Ids.hasNext() ) { Store.getRecordByCursor( Ids.next(), Record, RecordLoad.CHECK, Cursor ); if ( Record.inUse() ) { if ( PassesFilters( Record ) ) { return Record; } } } return default( R ); }
public override bool Next() { // Check tx state bool hasChanges = hasChanges(); if (hasChanges && _addedNodes.hasNext()) { _storeCursor.Current = _addedNodes.next(); return(true); } while (_storeCursor.next()) { if (!hasChanges || !_read.txState().nodeIsDeletedInThisTx(_storeCursor.entityReference())) { return(true); } } return(false); }
public override bool Next() { // Check tx state bool hasChanges = hasChanges(); if (hasChanges && _addedRelationships.hasNext()) { Read.txState().relationshipVisit(_addedRelationships.next(), StoreCursor); return(true); } while (StoreCursor.next()) { if (!hasChanges || !Read.txState().relationshipIsDeletedInThisTx(StoreCursor.entityReference())) { return(true); } } return(false); }
/// <summary> /// used by the consistency checker /// </summary> public static LongIterator ExactIndexMatches(NodePropertyAccessor accessor, LongIterator indexedNodeIds, params IndexQuery[] predicates) { if (!indexedNodeIds.hasNext()) { return(indexedNodeIds); } //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: IndexQuery[] filteredPredicates = java.util.predicates.Where(LookupFilter.isNumericOrGeometricPredicate).ToArray(IndexQuery[] ::new); if (filteredPredicates.Length > 0) { System.Func <long, bool> combinedPredicate = nodeId => { try { foreach (IndexQuery predicate in filteredPredicates) { int propertyKeyId = predicate.propertyKeyId(); Value value = accessor.GetNodePropertyValue(nodeId, propertyKeyId); if (!predicate.acceptsValue(value)) { return(false); } } return(true); } catch (EntityNotFoundException) { return(false); // The node has been deleted but was still reported from the index. CC will catch // this through other mechanism (NodeInUseWithCorrectLabelsCheck), so we can // silently ignore here } }; return(PrimitiveLongCollections.filter(indexedNodeIds, combinedPredicate)); } return(indexedNodeIds); }