it.unimi.dsi.fastutil.longs.Long2ObjectMap Java Examples
The following examples show how to use
it.unimi.dsi.fastutil.longs.Long2ObjectMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchematicWorldRenderingNotifier.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
public static void markSchematicChunksForRenderUpdate(ChunkPos chunkPos) { World world = SchematicWorldHandler.getSchematicWorld(); if (world != null) { Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks(); Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks(); long key = ChunkPos.asLong(chunkPos.x, chunkPos.z); if (schematicChunks.containsKey(key) && clientChunks.containsKey(key)) { RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer(); rg.markBlockRangeForRenderUpdate((chunkPos.x << 4) - 1, 0, (chunkPos.z << 4) - 1, (chunkPos.x << 4) + 1, 255, (chunkPos.z << 4) + 1); } } }
Example #2
Source File: AgreeSetGenerator.java From metanome-algorithms with Apache License 2.0 | 6 votes |
private void handleList(IntList list, Long2ObjectMap<Set<IntList>> maxSets, boolean firstStep) { for (int i = 0; i < list.size(); i++) { int removedElement = list.removeInt(i); if (maxSets.containsKey(list.size()) && maxSets.get(list.size()).contains(list)) maxSets.get(list.size()).remove(list); else { if (list.size() > 2) { this.handleList(list, maxSets, false); } } list.add(i, removedElement); } if (firstStep) maxSets.get(list.size()).add(list); }
Example #3
Source File: TopSecondDegreeByCount.java From GraphJet with Apache License 2.0 | 6 votes |
private void updateAlgorithmStats(long queryNode) { topSecondDegreeByCountStats.setNumDirectNeighbors( leftIndexedBipartiteGraph.getLeftNodeDegree(queryNode) ); int minVisitsPerRightNode = Integer.MAX_VALUE; int maxVisitsPerRightNode = 0; int numRHSVisits = 0; for (Long2ObjectMap.Entry<NodeInfo> entry: visitedRightNodes.long2ObjectEntrySet()) { NodeInfo nodeInfo = entry.getValue(); int numVisits = nodeInfo.getNumVisits(); minVisitsPerRightNode = Math.min(minVisitsPerRightNode, numVisits); maxVisitsPerRightNode = Math.max(maxVisitsPerRightNode, numVisits); numRHSVisits += numVisits; } topSecondDegreeByCountStats.setMinVisitsPerRightNode(minVisitsPerRightNode); topSecondDegreeByCountStats.setMaxVisitsPerRightNode(maxVisitsPerRightNode); topSecondDegreeByCountStats.setNumRHSVisits(numRHSVisits); topSecondDegreeByCountStats.setNumRightNodesReached(visitedRightNodes.size()); }
Example #4
Source File: AgreeSetGenerator.java From metanome-algorithms with Apache License 2.0 | 6 votes |
private void calculateRelationship(StrippedPartition partitions, Long2ObjectMap<TupleEquivalenceClassRelation> relationships) { int partitionNr = 0; for (IntList partition : partitions.getValues()) { if (this.debugSysout) System.out.println("."); for (long index : partition) { if (!relationships.containsKey(index)) { relationships.put(index, new TupleEquivalenceClassRelation()); } relationships.get(index).addNewRelationship(partitions.getAttributeID(), partitionNr); } partitionNr++; } }
Example #5
Source File: SalsaNodeVisitorTest.java From GraphJet with Apache License 2.0 | 6 votes |
@Test public void testSimpleNodeVisitor() throws Exception { SalsaNodeVisitor.SimpleNodeVisitor simpleNodeVisitor = new SalsaNodeVisitor.SimpleNodeVisitor( salsaInternalState.getVisitedRightNodes()); simpleNodeVisitor.resetWithRequest(salsaRequest); simpleNodeVisitor.visitRightNode(1, 2, (byte) 0, 0L, 1); simpleNodeVisitor.visitRightNode(2, 3, (byte) 0, 0L, 1); simpleNodeVisitor.visitRightNode(1, 3, (byte) 0, 0L, 1); Long2ObjectMap<NodeInfo> expectedVisitedRightNodesMap = new Long2ObjectOpenHashMap<NodeInfo>(2); expectedVisitedRightNodesMap.put(2, new NodeInfo(2, 1, 1)); expectedVisitedRightNodesMap.put(3, new NodeInfo(3, 2, 1)); assertEquals(expectedVisitedRightNodesMap, salsaInternalState.getVisitedRightNodes()); }
Example #6
Source File: SalsaNodeVisitorTest.java From GraphJet with Apache License 2.0 | 6 votes |
@Test public void testNodeVisitorWithSocialProof() throws Exception { SalsaNodeVisitor.NodeVisitorWithSocialProof nodeVisitorWithSocialProof = new SalsaNodeVisitor.NodeVisitorWithSocialProof( salsaInternalState.getVisitedRightNodes()); nodeVisitorWithSocialProof.resetWithRequest(salsaRequest); nodeVisitorWithSocialProof.visitRightNode(1, 2, (byte) 0, 0L, 1); nodeVisitorWithSocialProof.visitRightNode(2, 3, (byte) 0, 0L, 1); nodeVisitorWithSocialProof.visitRightNode(1, 3, (byte) 0, 0L, 1); NodeInfo node2 = new NodeInfo(2, 1, 1); NodeInfo node3 = new NodeInfo(3, 2, 1); assertTrue(node3.addToSocialProof(2, (byte) 0, 0L, 1)); Long2ObjectMap<NodeInfo> expectedVisitedRightNodesMap = new Long2ObjectOpenHashMap<NodeInfo>(2); expectedVisitedRightNodesMap.put(2, node2); expectedVisitedRightNodesMap.put(3, node3); assertEquals(expectedVisitedRightNodesMap, salsaInternalState.getVisitedRightNodes()); }
Example #7
Source File: SalsaBitmaskTest.java From GraphJet with Apache License 2.0 | 6 votes |
private StaticBipartiteGraph buildTestGraph() { Long2ObjectMap<LongList> leftSideGraph = new Long2ObjectOpenHashMap<LongList>(3); leftSideGraph.put(1, new LongArrayList(new long[]{2, 3, 4, 5})); leftSideGraph.put(2, new LongArrayList(new long[]{tweetNode, summaryNode, photoNode, playerNode, 2, 3})); leftSideGraph.put(3, new LongArrayList(new long[]{tweetNode, summaryNode, photoNode, playerNode, promotionNode, 4, 5})); Long2ObjectMap<LongList> rightSideGraph = new Long2ObjectOpenHashMap<LongList>(10); rightSideGraph.put(2, new LongArrayList(new long[]{1, 2})); rightSideGraph.put(3, new LongArrayList(new long[]{1, 2})); rightSideGraph.put(4, new LongArrayList(new long[]{1, 3})); rightSideGraph.put(5, new LongArrayList(new long[]{1, 3})); rightSideGraph.put(tweetNode, new LongArrayList(new long[]{2, 3})); rightSideGraph.put(summaryNode, new LongArrayList(new long[]{2, 3})); rightSideGraph.put(photoNode, new LongArrayList(new long[]{2, 3})); rightSideGraph.put(playerNode, new LongArrayList(new long[]{2, 3})); rightSideGraph.put(promotionNode, new LongArrayList(new long[]{3})); return new StaticBipartiteGraph(leftSideGraph, rightSideGraph); }
Example #8
Source File: BipartiteGraphTestHelper.java From GraphJet with Apache License 2.0 | 6 votes |
/** * Build a random bipartite graph of given left and right sizes. * * @param leftSize is the left hand size of the bipartite graph * @param rightSize is the right hand size of the bipartite graph * @param random is the random number generator to use for constructing the graph * @return a random bipartite graph */ public static StaticBipartiteGraph buildRandomBipartiteGraph( int leftSize, int rightSize, double edgeProbability, Random random) { Long2ObjectMap<LongList> leftSideGraph = new Long2ObjectOpenHashMap<LongList>(leftSize); Long2ObjectMap<LongList> rightSideGraph = new Long2ObjectOpenHashMap<LongList>(rightSize); int averageLeftDegree = (int) (rightSize * edgeProbability); int averageRightDegree = (int) (leftSize * edgeProbability); for (int i = 0; i < leftSize; i++) { leftSideGraph.put(i, new LongArrayList(averageLeftDegree)); for (int j = 0; j < rightSize; j++) { if (random.nextDouble() < edgeProbability) { leftSideGraph.get(i).add(j); if (rightSideGraph.containsKey(j)) { rightSideGraph.get(j).add(i); } else { LongList rightSideList = new LongArrayList(averageRightDegree); rightSideList.add(i); rightSideGraph.put(j, rightSideList); } } } } return new StaticBipartiteGraph(leftSideGraph, rightSideGraph); }
Example #9
Source File: SchematicWorldRenderingNotifier.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
public static void markSchematicChunkForRenderUpdate(BlockPos pos) { World world = SchematicWorldHandler.getSchematicWorld(); if (world != null) { Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks(); Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks(); long key = ChunkPos.asLong(pos.getX() >> 4, pos.getZ() >> 4); if (schematicChunks.containsKey(key) && clientChunks.containsKey(key)) { RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer(); rg.markBlockRangeForRenderUpdate(pos.getX() - 1, pos.getY() - 1, pos.getZ() - 1,pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); } } }
Example #10
Source File: SchematicWorldRenderingNotifier.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
public static void markSchematicChunkForRenderUpdate(SubChunkPos chunkPos) { World world = SchematicWorldHandler.getSchematicWorld(); if (world != null) { Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks(); Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks(); long key = ChunkPos.asLong(chunkPos.getX(), chunkPos.getZ()); if (schematicChunks.containsKey(key) && clientChunks.containsKey(key)) { RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer(); rg.markBlockRangeForRenderUpdate((chunkPos.getX() << 4) - 1, (chunkPos.getY() << 4) - 1, (chunkPos.getZ() << 4) - 1, (chunkPos.getX() << 4) + 1, (chunkPos.getY() << 4) + 1, (chunkPos.getZ() << 4) + 1); } } }
Example #11
Source File: BipartiteGraphTestHelper.java From GraphJet with Apache License 2.0 | 6 votes |
/** * Build a small test bipartite graph. * * @return a small test bipartite graph */ public static StaticBipartiteGraph buildSmallTestBipartiteGraph() { Long2ObjectMap<LongList> leftSideGraph = new Long2ObjectOpenHashMap<LongList>(3); leftSideGraph.put(1, new LongArrayList(new long[]{2, 3, 4, 5})); leftSideGraph.put(2, new LongArrayList(new long[]{5, 6, 10})); leftSideGraph.put(3, new LongArrayList(new long[]{7, 8, 5, 9, 2, 10, 11, 1})); Long2ObjectMap<LongList> rightSideGraph = new Long2ObjectOpenHashMap<LongList>(10); rightSideGraph.put(1, new LongArrayList(new long[]{3})); rightSideGraph.put(2, new LongArrayList(new long[]{1, 3})); rightSideGraph.put(3, new LongArrayList(new long[]{1})); rightSideGraph.put(4, new LongArrayList(new long[]{1})); rightSideGraph.put(5, new LongArrayList(new long[]{1, 2, 3})); rightSideGraph.put(6, new LongArrayList(new long[]{2})); rightSideGraph.put(7, new LongArrayList(new long[]{3})); rightSideGraph.put(8, new LongArrayList(new long[]{3})); rightSideGraph.put(9, new LongArrayList(new long[]{3})); rightSideGraph.put(10, new LongArrayList(new long[]{2, 3})); rightSideGraph.put(11, new LongArrayList(new long[]{3})); return new StaticBipartiteGraph(leftSideGraph, rightSideGraph); }
Example #12
Source File: SchematicWorldRenderingNotifier.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void updateBetweenY(int minY, int maxY) { World world = SchematicWorldHandler.getSchematicWorld(); if (world != null) { RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer(); Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks(); Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks(); for (Chunk chunk : schematicChunks.values()) { // Only mark chunks that are actually rendered (if the schematic world contains more chunks) if (chunk.isEmpty() == false && clientChunks.containsKey(ChunkPos.asLong(chunk.x, chunk.z))) { rg.markBlockRangeForRenderUpdate((chunk.x << 4) - 1, minY, (chunk.z << 4) - 1, (chunk.x << 4) + 16, maxY, (chunk.z << 4) + 16); } } } }
Example #13
Source File: SchemVis.java From FastAsyncWorldedit with GNU General Public License v3.0 | 6 votes |
/** * Discard chunks outside FOV */ private void clean() { if (chunks.size() > 225) { TaskManager.IMP.sync(() -> { if (chunks.size() > 225) { synchronized (SchemVis.this) { FaweLocation pos = player.getLocation(); int centerX = pos.x >> 4; int centerZ = pos.z >> 4; ObjectIterator<Long2ObjectMap.Entry<MCAChunk>> iter = chunks.long2ObjectEntrySet().fastIterator(); while (iter.hasNext()) { Long2ObjectMap.Entry<MCAChunk> entry = iter.next(); long pair = entry.getLongKey(); int chunkX = MathMan.unpairIntX(pair); int chunkZ = MathMan.unpairIntY(pair); if (Math.abs(centerX - chunkX) > 15 || Math.abs(centerZ - chunkZ) > 15) { iter.remove(); } } } } return null; }); } }
Example #14
Source File: FastCollectionsUtils.java From fastjgame with Apache License 2.0 | 6 votes |
/** * 移除map中符合条件的元素,并对删除的元素执行后续的操作。 * * @param map 必须是可修改的map * @param predicate 过滤条件,为真的删除 * @param then 元素删除之后执行的逻辑 * @param <V> the type of value * @return 删除的元素数量 */ public static <V> int removeIfAndThen(final Long2ObjectMap<V> map, final LongObjPredicate<? super V> predicate, LongObjConsumer<V> then) { if (map.size() == 0) { return 0; } ObjectIterator<Long2ObjectMap.Entry<V>> itr = map.long2ObjectEntrySet().iterator(); int removeNum = 0; Long2ObjectMap.Entry<V> entry; long k; V v; while (itr.hasNext()) { entry = itr.next(); k = entry.getLongKey(); v = entry.getValue(); if (predicate.test(k, v)) { itr.remove(); removeNum++; then.accept(k, v); } } return removeNum; }
Example #15
Source File: CodecRegistrys.java From fastjgame with Apache License 2.0 | 6 votes |
public static CodecRegistry fromAppPojoCodecs(TypeModelMapper typeModelMapper, List<PojoCodecImpl<?>> pojoCodecs) { final Long2ObjectMap<PojoCodecImpl<?>> typeId2CodecMap = new Long2ObjectOpenHashMap<>(pojoCodecs.size()); final IdentityHashMap<Class<?>, PojoCodecImpl<?>> type2CodecMap = new IdentityHashMap<>(pojoCodecs.size()); for (PojoCodecImpl<?> pojoCodec : pojoCodecs) { final Class<?> type = pojoCodec.getEncoderClass(); final TypeModel typeModel = typeModelMapper.ofType(type); if (typeModel == null) { continue; } FastCollectionsUtils.requireNotContains(typeId2CodecMap, typeModel.typeId().toGuid(), "typeId-(toGuid)"); CollectionUtils.requireNotContains(type2CodecMap, type, "type"); typeId2CodecMap.put(typeModel.typeId().toGuid(), pojoCodec); type2CodecMap.put(type, pojoCodec); } return new DefaultCodecRegistry(typeModelMapper, typeId2CodecMap, type2CodecMap); }
Example #16
Source File: DefaultTypeModelMapper.java From fastjgame with Apache License 2.0 | 6 votes |
public static DefaultTypeModelMapper newInstance(Collection<TypeModel> identifiers) { final Map<Class<?>, TypeModel> type2IdentifierMap = new IdentityHashMap<>(identifiers.size()); final Map<String, TypeModel> name2TypeMap = CollectionUtils.newHashMapWithExpectedSize(identifiers.size()); final Long2ObjectMap<TypeModel> number2TypeMap = new Long2ObjectOpenHashMap<>(identifiers.size()); for (TypeModel typeModel : identifiers) { CollectionUtils.requireNotContains(type2IdentifierMap, typeModel.type(), "type"); CollectionUtils.requireNotContains(name2TypeMap, typeModel.typeName(), "name"); FastCollectionsUtils.requireNotContains(number2TypeMap, typeModel.typeId().toGuid(), "id"); type2IdentifierMap.put(typeModel.type(), typeModel); name2TypeMap.put(typeModel.typeName(), typeModel); number2TypeMap.put(typeModel.typeId().toGuid(), typeModel); } return new DefaultTypeModelMapper(type2IdentifierMap, name2TypeMap, number2TypeMap); }
Example #17
Source File: MemoryFlamdex.java From imhotep with Apache License 2.0 | 5 votes |
@Override public boolean next() { if (!keys.hasNext()) { return false; } final Long2ObjectMap.Entry<IntArrayList> e = keys.next(); term = e.getLongKey(); docList = e.getValue(); // noinspection SimplifiableIfStatement if (docList.isEmpty()) return next(); return true; }
Example #18
Source File: BipartiteGraphTestHelper.java From GraphJet with Apache License 2.0 | 5 votes |
/** * Build a small test bipartite graph. * * @return a small test bipartite graph */ public static StaticLeftIndexedBipartiteGraph buildSmallTestLeftIndexedBipartiteGraph() { Long2ObjectMap<LongList> leftSideGraph = new Long2ObjectOpenHashMap<LongList>(3); leftSideGraph.put(1, new LongArrayList(new long[]{2, 3, 4, 5})); leftSideGraph.put(2, new LongArrayList(new long[]{5, 6, 10})); leftSideGraph.put(3, new LongArrayList(new long[]{7, 8, 5, 9, 2, 10, 11, 1})); return new StaticLeftIndexedBipartiteGraph(leftSideGraph); }
Example #19
Source File: ChunkListener.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public ChunkListener() { if (Settings.IMP.TICK_LIMITER.ENABLED) { PluginManager plm = Bukkit.getPluginManager(); Plugin plugin = Fawe.<FaweBukkit>imp().getPlugin(); plm.registerEvents(this, plugin); try { Fawe.debug("Detected " + BlockExplodeEvent.class); plm.registerEvents(new ChunkListener_8Plus(this), plugin); } catch (Throwable ignore) {} TaskManager.IMP.repeat(new Runnable() { @Override public void run() { rateLimit--; physicsFreeze = false; itemFreeze = false; lastZ = Integer.MIN_VALUE; physSkip = 0; physCancelPair = Long.MIN_VALUE; physCancel = false; counter.clear(); for (Long2ObjectMap.Entry<Boolean> entry : badChunks.long2ObjectEntrySet()) { long key = entry.getLongKey(); int x = MathMan.unpairIntX(key); int z = MathMan.unpairIntY(key); counter.put(key, badLimit); } badChunks.clear(); } }, Settings.IMP.TICK_LIMITER.INTERVAL); } }
Example #20
Source File: SchemVis.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
private Set<File> getFiles(BlockVector2D chunkPosA, BlockVector2D chunkPosB) { BlockVector2D pos1 = new BlockVector2D(Math.min(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.min(chunkPosA.getBlockZ(), chunkPosB.getBlockZ())); BlockVector2D pos2 = new BlockVector2D(Math.max(chunkPosA.getBlockX(), chunkPosB.getBlockX()), Math.max(chunkPosA.getBlockZ(), chunkPosB.getBlockZ())); Set<File> contained = new HashSet<>(); for (Long2ObjectMap.Entry<Map.Entry<File, Long>> entry : files.long2ObjectEntrySet()) { long key = entry.getLongKey(); int chunkX = MathMan.unpairIntX(key); if (chunkX < pos1.getBlockX() || chunkX > pos2.getBlockX()) continue; int chunkZ = MathMan.unpairIntY(key); if (chunkZ < pos1.getBlockZ() || chunkZ > pos2.getBlockZ()) continue; contained.add(entry.getValue().getKey()); } return contained; }
Example #21
Source File: SalsaIterationsTest.java From GraphJet with Apache License 2.0 | 5 votes |
@Test public void testSingleLeftIteration() throws Exception { SalsaIterations<BipartiteGraph> salsaIterations = new SalsaIterations<BipartiteGraph>( salsaInternalState, new LeftSalsaIteration(salsaInternalState), new RightSalsaIteration(salsaInternalState), new FinalSalsaIteration(salsaInternalState) ); salsaIterations.resetWithRequest(salsaRequest, random); SingleSalsaIteration leftSalsaIteration = new LeftSalsaIteration(salsaInternalState); leftSalsaIteration.resetWithRequest(salsaRequest, random); salsaIterations.seedLeftSideForFirstIteration(); leftSalsaIteration.runSingleIteration(); Long2ObjectMap<NodeInfo> expectedVisitedRightNodesMap = new Long2ObjectOpenHashMap<NodeInfo>(9); // highest weight expectedVisitedRightNodesMap.put(2, new NodeInfo(2, 167, 1)); expectedVisitedRightNodesMap.put(3, new NodeInfo(3, 168, 1)); expectedVisitedRightNodesMap.put(4, new NodeInfo(4, 167, 1)); expectedVisitedRightNodesMap.put(5, new NodeInfo(5, 177, 1)); // medium weight expectedVisitedRightNodesMap.put(6, new NodeInfo(6, 22, 1)); expectedVisitedRightNodesMap.put(10, new NodeInfo(10, 25, 1)); // small weight expectedVisitedRightNodesMap.put(7, new NodeInfo(7, 2, 1)); expectedVisitedRightNodesMap.put(9, new NodeInfo(9, 1, 1)); expectedVisitedRightNodesMap.put(11, new NodeInfo(11, 1, 1)); assertEquals(1, salsaInternalState.getCurrentLeftNodes().size()); assertEquals(expectedVisitedRightNodesMap, salsaInternalState.getVisitedRightNodes()); }
Example #22
Source File: NodeMetadataSocialProofResult.java From GraphJet with Apache License 2.0 | 5 votes |
/** * Calculate the total number of interactions for the current nodeMetadataId (right node's metadata) * given the set of users (left nodes). * * @return the number of unique edgeType/user/tweet interactions. * For example (0 (byte), 12 (long), 99 (long)) would be a single unique interaction. */ public int getSocialProofSize() { int socialProofSize = 0; for (Long2ObjectMap<LongSet> userToTweetsMap: socialProof.values()) { for (LongSet connectingTweets: userToTweetsMap.values()) { socialProofSize += connectingTweets.size(); } } return socialProofSize; }
Example #23
Source File: NodeMetadataSocialProofResult.java From GraphJet with Apache License 2.0 | 5 votes |
public NodeMetadataSocialProofResult( int nodeMetadataId, Byte2ObjectMap<Long2ObjectMap<LongSet>> socialProof, double weight, RecommendationType recommendationType ) { this.nodeMetadataId = nodeMetadataId; this.socialProof = socialProof; this.weight = weight; this.recommendationType = recommendationType; }
Example #24
Source File: MemoryFlamdex.java From imhotep with Apache License 2.0 | 5 votes |
private static long usage(Long2ObjectMap<IntArrayList> map) { long size = INT_2_OBJECT_RB_TREE_MAP_USAGE; size += map.size() * INT_2_OBJECT_RB_TREE_MAP_ENTRY_USAGE; for (final IntArrayList list : map.values()) { size += INT_ARRAY_LIST_USAGE + 4 * list.elements().length; } return size; }
Example #25
Source File: AgreeSetGenerator.java From metanome-algorithms with Apache License 2.0 | 5 votes |
private IntersectWithAndAddToAgreeSetTask(int i, int j, IntList maxEquiClass, Long2ObjectMap<TupleEquivalenceClassRelation> relationships, Map<AgreeSet, Object> agreeSets) { this.i = i; this.j = j; this.maxEquiClass = maxEquiClass; this.relationships = relationships; this.agreeSets = agreeSets; }
Example #26
Source File: AgreeSetGenerator.java From metanome-algorithms with Apache License 2.0 | 5 votes |
private Set<IntList> mergeResult(Long2ObjectMap<Set<IntList>> maxSets) { Set<IntList> max = new HashSet<IntList>(); for (Set<IntList> set : maxSets.values()) { max.addAll(set); } return max; }
Example #27
Source File: ClientCacheMissResponseSerializer_v388.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void deserialize(ByteBuf buffer, ClientCacheMissResponsePacket packet) { Long2ObjectMap<byte[]> blobs = packet.getBlobs(); int length = VarInts.readUnsignedInt(buffer); for (int i = 0; i < length; i++) { long id = buffer.readLongLE(); byte[] blob = BedrockUtils.readByteArray(buffer); blobs.put(id, blob); } }
Example #28
Source File: ClientCacheMissResponseSerializer_v388.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, ClientCacheMissResponsePacket packet) { Long2ObjectMap<byte[]> blobs = packet.getBlobs(); VarInts.writeUnsignedInt(buffer, blobs.size()); blobs.forEach((id, blob) -> { buffer.writeLongLE(id); BedrockUtils.writeByteArray(buffer, blob); }); }
Example #29
Source File: ClientCacheMissResponseSerializer_v361.java From Protocol with Apache License 2.0 | 5 votes |
@Override public void serialize(ByteBuf buffer, ClientCacheMissResponsePacket packet) { Long2ObjectMap<byte[]> blobs = packet.getBlobs(); VarInts.writeUnsignedInt(buffer, blobs.size()); blobs.forEach((id, blob) -> { buffer.writeLongLE(id); BedrockUtils.writeByteArray(buffer, blob); }); }
Example #30
Source File: SchematicWorldRenderingNotifier.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void updateBetweenZ(int minZ, int maxZ) { World world = SchematicWorldHandler.getSchematicWorld(); if (world != null) { final int zMin = Math.min(minZ, maxZ); final int zMax = Math.max(minZ, maxZ); final int czMin = (zMin >> 4); final int czMax = (zMax >> 4); RenderGlobal rg = LitematicaRenderer.getInstance().getWorldRenderer(); Long2ObjectMap<Chunk> schematicChunks = ((IMixinChunkProviderClient) (Object) world.getChunkProvider()).getLoadedChunks(); Long2ObjectMap<Chunk> clientChunks = ((IMixinChunkProviderClient) (Object) Minecraft.getMinecraft().world.getChunkProvider()).getLoadedChunks(); for (Chunk chunk : schematicChunks.values()) { // Only mark chunks that are actually rendered (if the schematic world contains more chunks) if (chunk.z >= czMin && chunk.z <= czMax && chunk.isEmpty() == false && clientChunks.containsKey(ChunkPos.asLong(chunk.x, chunk.z))) { minZ = Math.max( chunk.z << 4 , zMin); maxZ = Math.min((chunk.z << 4) + 15, zMax); rg.markBlockRangeForRenderUpdate((chunk.x << 4), 0, minZ, (chunk.x << 4) + 15, 255, maxZ); } } } }