Java Code Examples for it.unimi.dsi.fastutil.longs.Long2ObjectMap#values()

The following examples show how to use it.unimi.dsi.fastutil.longs.Long2ObjectMap#values() . 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 vote down vote up
@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 2
Source File: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void updateBetweenX(int minX, int maxX)
{
    World world = SchematicWorldHandler.getSchematicWorld();

    if (world != null)
    {
        final int xMin = Math.min(minX, maxX);
        final int xMax = Math.max(minX, maxX);
        final int cxMin = (xMin >> 4);
        final int cxMax = (xMax >> 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.x >= cxMin && chunk.x <= cxMax && chunk.isEmpty() == false &&
                clientChunks.containsKey(ChunkPos.asLong(chunk.x, chunk.z)))
            {
                minX = Math.max( chunk.x << 4      , xMin);
                maxX = Math.min((chunk.x << 4) + 15, xMax);
                rg.markBlockRangeForRenderUpdate(minX, 0, (chunk.z << 4), maxX, 255, (chunk.z << 4) + 15);
            }
        }
    }
}
 
Example 3
Source File: SchematicWorldRenderingNotifier.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
            }
        }
    }
}
 
Example 4
Source File: AgreeSetGenerator.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
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 5
Source File: NodeMetadataSocialProofResult.java    From GraphJet with Apache License 2.0 5 votes vote down vote up
/**
 * 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 6
Source File: MemoryFlamdex.java    From imhotep with Apache License 2.0 5 votes vote down vote up
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;
}