@Override void mark(int entityId) { if (pool != null) { PooledComponent c = (PooledComponent) components.get(entityId); if (c != null) pool.free(c); } components.unsafeSet(entityId, null); }
private A createNew() { return (A) ((pool != null) ? pool.obtain() : ComponentManager.newInstance(type.getType())); }
@SuppressWarnings("unchecked") public ComponentMapper(Class<A> type, World world) { super(world.getComponentManager().typeFactory.getTypeFor(type)); components = new Bag<>(type); pool = (this.type.isPooled) ? new ComponentPool(type) : null; if (world.isAlwaysDelayComponentRemoval() || isAnnotationPresent(type, DelayedComponentRemoval.class)) purgatory = new DelayedComponentRemover<>(components, pool, world.batchProcessor); else purgatory = new ImmediateComponentRemover<>(components, pool); createTransmuter = new EntityTransmuterFactory(world).add(type).build(); removeTransmuter = new EntityTransmuterFactory(world).remove(type).build(); }
@SuppressWarnings("unchecked") public ComponentMapper(Class<A> type, World world) { super(world.getComponentManager().typeFactory.getTypeFor(type)); components = new Bag<>(type); pool = (this.type.isPooled) ? new ComponentPool(type) : null; if (world.isAlwaysDelayComponentRemoval() || isAnnotationPresent(type, DelayedComponentRemoval.class)) purgatory = new DelayedComponentRemover<>(components, pool, world.batchProcessor); else purgatory = new ImmediateComponentRemover<>(components, pool); createTransmuter = new EntityTransmuterFactory(world).add(type).build(); removeTransmuter = new EntityTransmuterFactory(world).remove(type).build(); }
@Override void mark(int entityId) { if (pool != null) { PooledComponent c = (PooledComponent) components.get(entityId); if (c != null) pool.free(c); } components.unsafeSet(entityId, null); }
private A createNew() { return (A) ((pool != null) ? pool.obtain() : ComponentManager.newInstance(type.getType())); }
@Override boolean unmark(int entityId) { if (idBits.get(entityId)) { idBits.clear(entityId); if (pool != null) { pool.free((PooledComponent) components.get(entityId)); } return true; } else { return false; } }
@Override boolean unmark(int entityId) { if (idBits.get(entityId)) { idBits.clear(entityId); if (pool != null) { pool.free((PooledComponent) components.get(entityId)); } return true; } else { return false; } }
private void purgeWithPool() { for (int id = idBits.nextSetBit(0); id >= 0; id = idBits.nextSetBit(id + 1)) { A c = components.get(id); pool.free((PooledComponent) c); components.unsafeSet(id, null); } }
private void purgeWithPool() { for (int id = idBits.nextSetBit(0); id >= 0; id = idBits.nextSetBit(id + 1)) { A c = components.get(id); pool.free((PooledComponent) c); components.unsafeSet(id, null); } }