Examples of LongList


Examples of it.unimi.dsi.fastutil.longs.LongList

        assertThat(list, contains(val, 42L));
    }

    @Test
    public void testAddAndPrependUpgrade() {
        LongList list = new CompactableLongArrayList();
        long val = Integer.MAX_VALUE + 42L;
        list.add(42);
        list.add(0, val);
        assertThat(list.size(), equalTo(2));
        assertThat(list, contains(val, 42L));
        assertThat(list.get(0), equalTo(val));
        assertThat(list.get(1), equalTo(42L));
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.longs.LongList

        assertThat(list.get(1), equalTo(42L));
    }

    @Test
    public void testSetReplace() {
        LongList list = new CompactableLongArrayList();
        long val = 67L;
        list.add(42);
        list.add(37);
        list.add(4);
        assertThat(list.set(1, val), equalTo(37L));
        assertThat(list.size(), equalTo(3));
        assertThat(list, contains(42L, val, 4L));
    }
View Full Code Here

Examples of nallar.collections.LongList

    profiler.startSection("spawnableChunks");
    int attemptedSpawnedMobs = 0;
    LongSet closeChunks = new LongSet();
    Collection<EntityPlayer> entityPlayers = worldServer.playerEntities;
    LongList spawnableChunks = new LongList(entityPlayers.size() * maxChunksPerPlayer);
    for (EntityPlayer entityPlayer : entityPlayers) {
      int pX = entityPlayer.chunkCoordX;
      int pZ = entityPlayer.chunkCoordZ;
      int x = pX - closeRange;
      int maxX = pX + closeRange;
      int startZ = pZ - closeRange;
      int maxZ = pZ + closeRange;
      for (; x <= maxX; x++) {
        for (int z = startZ; z <= maxZ; z++) {
          closeChunks.add(hash(x, z));
        }
      }
    }
    for (EntityPlayer entityPlayer : entityPlayers) {
      int pX = entityPlayer.chunkCoordX;
      int pZ = entityPlayer.chunkCoordZ;
      int x = pX - farRange;
      int maxX = pX + farRange;
      int startZ = pZ - farRange;
      int maxZ = pZ + farRange;
      for (; x <= maxX; x++) {
        for (int z = startZ; z <= maxZ; z++) {
          long hash = hash(x, z);
          if (!closeChunks.contains(hash)) {
            spawnableChunks.add(hash);
          }
        }
      }
    }
    profiler.endStartSection("spawnMobs");

    int size = spawnableChunks.size;
    if (size < 1) {
      return 0;
    }

    SpawnLoop:
    for (Map.Entry<EnumCreatureType, Integer> entry : requiredSpawns.entrySet()) {
      EnumCreatureType creatureType = entry.getKey();
      long hash = spawnableChunks.get(worldServer.rand.nextInt(size));
      int x = (int) (hash >> 32);
      int z = (int) hash;
      int sX = x * 16 + worldServer.rand.nextInt(16);
      int sZ = z * 16 + worldServer.rand.nextInt(16);
      boolean surface = creatureType.getPeacefulCreature() || (dayTime ? surfaceChance++ % 5 == 0 : surfaceChance++ % 5 != 0);
View Full Code Here

Examples of org.apache.commons.collections.primitives.LongList

    public void testWrapNull() {
        assertNull(ListLongList.wrap(null));
    }
   
    public void testWrapSerializable() {
        LongList list = ListLongList.wrap(new ArrayList());
        assertNotNull(list);
        assertTrue(list instanceof Serializable);
    }
View Full Code Here

Examples of org.eclipse.jgit.util.LongList

          JGitText.get().unknownObjectType, Integer.valueOf(typeCode)));
    }
  }

  private boolean isCorrupt(long offset) {
    LongList list = corruptObjects;
    if (list == null)
      return false;
    synchronized (list) {
      return list.contains(offset);
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.util.LongList

      return list.contains(offset);
    }
  }

  private void setCorrupt(long offset) {
    LongList list = corruptObjects;
    if (list == null) {
      synchronized (initLock) {
        list = corruptObjects;
        if (list == null) {
          list = new LongList();
          corruptObjects = list;
        }
      }
    }
    synchronized (list) {
      list.add(offset);
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.util.LongList

      reverseIdx = new PackReverseIndex(idx());
    return reverseIdx;
  }

  private boolean isCorrupt(long offset) {
    LongList list = corruptObjects;
    if (list == null)
      return false;
    synchronized (list) {
      return list.contains(offset);
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.util.LongList

      return list.contains(offset);
    }
  }

  private void setCorrupt(long offset) {
    LongList list = corruptObjects;
    if (list == null) {
      synchronized (readLock) {
        list = corruptObjects;
        if (list == null) {
          list = new LongList();
          corruptObjects = list;
        }
      }
    }
    synchronized (list) {
      list.add(offset);
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.util.LongList

          JGitText.get().unknownObjectType, Integer.valueOf(typeCode)));
    }
  }

  private boolean isCorrupt(long offset) {
    LongList list = corruptObjects;
    if (list == null)
      return false;
    synchronized (list) {
      return list.contains(offset);
    }
  }
View Full Code Here

Examples of org.eclipse.jgit.util.LongList

      return list.contains(offset);
    }
  }

  private void setCorrupt(long offset) {
    LongList list = corruptObjects;
    if (list == null) {
      synchronized (initLock) {
        list = corruptObjects;
        if (list == null) {
          list = new LongList();
          corruptObjects = list;
        }
      }
    }
    synchronized (list) {
      list.add(offset);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.