/** * Checks if the internal storage supports this index. * * @param index * index to check * * @return {@code true} if the index is within bounds */ public boolean isIndexWithinBounds(int index) { return index < getCapacity(); }
/** * Checks if the internal storage supports this index. * * @param index * index to check * * @return {@code true} if the index is within bounds */ public boolean isIndexWithinBounds(int index) { return index < getCapacity(); }
/** * Checks if the internal storage supports this index. * * @param index * index to check * * @return {@code true} if the index is within bounds */ public boolean isIndexWithinBounds(int index) { return index < getCapacity(); }
public void registerEntityStore(BitVector bv) { bv.ensureCapacity(entities.getCapacity()); entityBitVectors.add(bv); }
public void registerEntityStore(BitVector bv) { bv.ensureCapacity(entities.getCapacity()); entityBitVectors.add(bv); }
/** * Instantiates an Entity without registering it into the world. * @param id The ID to be set on the Entity */ private Entity createEntity(int id) { Entity e = new Entity(world, id); if (e.id >= entities.getCapacity()) { growEntityStores(); } // can't use unsafe set, as we need to track highest id // for faster iteration when syncing up new subscriptions // in ComponentManager#synchronize entities.set(e.id, e); return e; }
/** * Instantiates an Entity without registering it into the world. * @param id The ID to be set on the Entity */ private Entity createEntity(int id) { Entity e = new Entity(world, id); if (e.id >= entities.getCapacity()) { growEntityStores(); } // can't use unsafe set, as we need to track highest id // for faster iteration when syncing up new subscriptions // in ComponentManager#synchronize entities.set(e.id, e); return e; }
private void growEntityStores() { int newSize = 2 * entities.getCapacity(); entities.ensureCapacity(newSize); ComponentManager cm = world.getComponentManager(); cm.ensureCapacity(newSize); for (int i = 0, s = entityBitVectors.size(); s > i; i++) { entityBitVectors.get(i).ensureCapacity(newSize); } }
private void growEntityStores() { int newSize = 2 * entities.getCapacity(); entities.ensureCapacity(newSize); ComponentManager cm = world.getComponentManager(); cm.ensureCapacity(newSize); for (int i = 0, s = entityBitVectors.size(); s > i; i++) { entityBitVectors.get(i).ensureCapacity(newSize); } }