//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHaveDenseNodesWithBigCounts() public virtual void ShouldHaveDenseNodesWithBigCounts() { // A count of a dense node follow a different path during import, first there's counting per node // then import goes into actual import of relationships where individual chain degrees are // kept. So this test will first set a total count, then set count for a specific chain // GIVEN _cache = new NodeRelationshipCache(NumberArrayFactory.HEAP, 1, 100, Base); long nodeId = 1; int typeId = 10; _cache.NodeCount = nodeId + 1; _cache.setCount(nodeId, 2, typeId, OUTGOING); // surely dense now _cache.getAndPutRelationship(nodeId, typeId, OUTGOING, 1, true); _cache.getAndPutRelationship(nodeId, typeId, INCOMING, 2, true); // WHEN long highCountOut = NodeRelationshipCache.MaxCount - 100; long highCountIn = NodeRelationshipCache.MaxCount - 50; _cache.setCount(nodeId, highCountOut, typeId, OUTGOING); _cache.setCount(nodeId, highCountIn, typeId, INCOMING); _cache.getAndPutRelationship(nodeId, typeId, OUTGOING, 1, true); _cache.getAndPutRelationship(nodeId, typeId, INCOMING, 2, true); // THEN assertEquals(highCountOut + 1, _cache.getCount(nodeId, typeId, OUTGOING)); assertEquals(highCountIn + 1, _cache.getCount(nodeId, typeId, INCOMING)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldResetCountAfterGetOnDenseNodes() public virtual void ShouldResetCountAfterGetOnDenseNodes() { // GIVEN _cache = new NodeRelationshipCache(NumberArrayFactory_Fields.AutoWithoutPagecache, 1, 100, Base); long nodeId = 0; int typeId = 3; _cache.NodeCount = 1; _cache.incrementCount(nodeId); _cache.incrementCount(nodeId); _cache.getAndPutRelationship(nodeId, typeId, OUTGOING, 10, true); _cache.getAndPutRelationship(nodeId, typeId, OUTGOING, 12, true); assertTrue(_cache.isDense(nodeId)); // WHEN long count = _cache.getCount(nodeId, typeId, OUTGOING); assertEquals(2, count); // THEN assertEquals(0, _cache.getCount(nodeId, typeId, OUTGOING)); }
internal virtual long GetAndResetCount(long relGroupIndex, int typeId, Direction direction) { long index = Rebase(relGroupIndex); while (index != EMPTY) { ByteArray array = this.Array.at(index); if (GetTypeId(array, index) == typeId) { int offset = CountOffset(direction); long count = _outerInstance.getCount(array, index, offset); _outerInstance.setCount(array, index, offset, 0); return(count); } index = GetNext(array, index); } return(0); }