/** * Set element at specified index in the bag. * * @param index * position of element * @param e * the element */ public void set(int index, E e) { if(index >= data.length) grow(max((2 * data.length), index + 1)); size = Math.max(size, index + 1); unsafeSet(index, e); }
/** * Set element at specified index in the bag. * * @param index * position of element * @param e * the element */ public void set(int index, E e) { if(index >= data.length) grow(max((2 * data.length), index + 1)); size = Math.max(size, index + 1); unsafeSet(index, e); }
private void purgeNoPool() { for (int id = idBits.nextSetBit(0); id >= 0; id = idBits.nextSetBit(id + 1)) { components.unsafeSet(id, null); } } }
private void purgeNoPool() { for (int id = idBits.nextSetBit(0); id >= 0; id = idBits.nextSetBit(id + 1)) { components.unsafeSet(id, null); } } }
@Override void mark(int entityId) { if (pool != null) { PooledComponent c = (PooledComponent) components.get(entityId); if (c != null) pool.free(c); } components.unsafeSet(entityId, null); }
@Override void mark(int entityId) { if (pool != null) { PooledComponent c = (PooledComponent) components.get(entityId); if (c != null) pool.free(c); } components.unsafeSet(entityId, null); }
@Override public A internalCreate(int entityId) { A component = get(entityId); if (component == null || purgatory.unmark(entityId)) { component = createNew(); components.unsafeSet(entityId, component); } return component; }
@Override public A internalCreate(int entityId) { A component = get(entityId); if (component == null || purgatory.unmark(entityId)) { component = createNew(); components.unsafeSet(entityId, component); } return component; }
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); } }
/** * Create component for this entity. * Avoids creation if component exists. * * @param entityId the entity that should possess the component * @return the instance of the component. */ @Override public A create(int entityId) { A component = get(entityId); if (component == null || purgatory.unmark(entityId)) { // running transmuter first, as it performs som validation createTransmuter.transmuteNoOperation(entityId); component = createNew(); components.unsafeSet(entityId, component); } return component; }
/** * Create component for this entity. * Avoids creation if component exists. * * @param entityId the entity that should possess the component * @return the instance of the component. */ @Override public A create(int entityId) { A component = get(entityId); if (component == null || purgatory.unmark(entityId)) { // running transmuter first, as it performs som validation createTransmuter.transmuteNoOperation(entityId); component = createNew(); components.unsafeSet(entityId, component); } return component; }