//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void putAll() internal virtual void PutAll() { _map.putAll(LongObjectHashMap.newWithKeysValues(0, intValue(10), 1, intValue(11), 2, intValue(12))); assertEquals(3, _map.size()); assertEquals(intValue(10), _map.get(0)); assertEquals(intValue(11), _map.get(1)); assertEquals(intValue(12), _map.get(2)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void getIfAbsent() internal virtual void getIfAbsent() { assertEquals(intValue(-1), _map.getIfAbsent(0, () => intValue(-1))); assertEquals(intValue(-1), _map.getIfAbsent(1, () => intValue(-1))); assertEquals(intValue(-1), _map.getIfAbsent(2, () => intValue(-1))); assertEquals(intValue(-1), _map.getIfAbsent(3, () => intValue(-1))); _map.putAll(LongObjectHashMap.newWithKeysValues(0, intValue(10), 1, intValue(11), 2, intValue(12))); assertEquals(intValue(10), _map.getIfAbsent(0, () => intValue(-1))); assertEquals(intValue(11), _map.getIfAbsent(1, () => intValue(-1))); assertEquals(intValue(12), _map.getIfAbsent(2, () => intValue(-1))); assertEquals(intValue(-1), _map.getIfAbsent(3, () => intValue(-1))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void clear() internal virtual void Clear() { _map.clear(); assertEquals(0, _map.size()); _map.putAll(LongObjectHashMap.newWithKeysValues(0, intValue(10), 1, intValue(11), 2, intValue(12))); assertEquals(3, _map.size()); _map.clear(); assertEquals(0, _map.size()); _map.clear(); assertEquals(0, _map.size()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void forEachKeyValue() internal virtual void ForEachKeyValue() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.block.procedure.primitive.LongObjectProcedure<org.neo4j.values.storable.Value> consumer = mock(org.eclipse.collections.api.block.procedure.primitive.LongObjectProcedure.class); LongObjectProcedure <Value> consumer = mock(typeof(LongObjectProcedure)); _map.putAll(LongObjectHashMap.newWithKeysValues(0, intValue(10), 1, intValue(11), 2, intValue(12))); _map.forEachKeyValue(consumer); verify(consumer).value(eq(0L), eq(intValue(10))); verify(consumer).value(eq(1L), eq(intValue(11))); verify(consumer).value(eq(2L), eq(intValue(12))); verifyNoMoreInteractions(consumer); }
internal SchemaCacheState(SchemaCacheState schemaCacheState) { this.ConstraintSemantics = schemaCacheState.ConstraintSemantics; this.IndexDescriptorById = LongObjectHashMap.newMap(schemaCacheState.IndexDescriptorById); this.ConstraintRuleById = LongObjectHashMap.newMap(schemaCacheState.ConstraintRuleById); this.ConstraintsConflict = new HashSet <ConstraintDescriptor>(schemaCacheState.ConstraintsConflict); this.IndexDescriptorsConflict = new Dictionary <SchemaDescriptor, CapableIndexDescriptor>(schemaCacheState.IndexDescriptorsConflict); this.IndexDescriptorsByLabel = new IntObjectHashMap <ISet <CapableIndexDescriptor> >(schemaCacheState.IndexDescriptorsByLabel.size()); schemaCacheState.IndexDescriptorsByLabel.forEachKeyValue((k, v) => IndexDescriptorsByLabel.put(k, new HashSet <>(v))); this.IndexDescriptorsByRelationshipType = new IntObjectHashMap <ISet <CapableIndexDescriptor> >(schemaCacheState.IndexDescriptorsByRelationshipType.size()); schemaCacheState.IndexDescriptorsByRelationshipType.forEachKeyValue((k, v) => IndexDescriptorsByRelationshipType.put(k, new HashSet <>(v))); this.IndexDescriptorsByName = new Dictionary <string, CapableIndexDescriptor>(schemaCacheState.IndexDescriptorsByName); this.DependantState = new ConcurrentDictionary <Type, object>(); this.IndexByProperty = new IntObjectHashMap <IList <CapableIndexDescriptor> >(schemaCacheState.IndexByProperty.size()); schemaCacheState.IndexByProperty.forEachKeyValue((k, v) => IndexByProperty.put(k, new List <>(v))); this.IndexProviderMap = schemaCacheState.IndexProviderMap; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPutRandomStuff() public virtual void ShouldPutRandomStuff() { // GIVEN int typeId = 10; int nodes = 10_000; MutableLongObjectMap <long[]> key = new LongObjectHashMap <long[]>(nodes); _cache = new NodeRelationshipCache(NumberArrayFactory.HEAP, 1, 1000, Base); // mark random nodes as dense (dense node threshold is 1 so enough with one increment _cache.NodeCount = nodes; for (long nodeId = 0; nodeId < nodes; nodeId++) { if (Random.nextBoolean()) { _cache.incrementCount(nodeId); } } // WHEN for (int i = 0; i < 100_000; i++) { long nodeId = Random.nextLong(nodes); bool dense = _cache.isDense(nodeId); Direction direction = Random.among(Direction.values()); long relationshipId = Random.nextLong(1_000_000); long previousHead = _cache.getAndPutRelationship(nodeId, typeId, direction, relationshipId, false); long[] keyIds = key.get(nodeId); int keyIndex = dense ? direction.ordinal() : 0; if (keyIds == null) { key.put(nodeId, keyIds = MinusOneLongs(Direction.values().length)); } assertEquals(keyIds[keyIndex], previousHead); keyIds[keyIndex] = relationshipId; } }
public override IndexMap Clone() { return(new IndexMap(LongObjectHashMap.newMap(_indexesById), CloneMap(_indexesByDescriptor), new ObjectLongHashMap <>(_indexIdsByDescriptor), LongObjectHashMap.newMap(_uniquenessConstraintsById))); }