/** * Removes the first occurrence of the value from this IntBag, if * it is present. * * @param value * the value to be removed * * @return true, if value was removed */ public boolean removeValue(int value) throws ArrayIndexOutOfBoundsException { int index = indexOf(value); if (index > -1) remove(index); return index > -1; }
/** * Removes the first occurrence of the value from this IntBag, if * it is present. * * @param value * the value to be removed * * @return true, if value was removed */ public boolean removeValue(int value) throws ArrayIndexOutOfBoundsException { int index = indexOf(value); if (index > -1) remove(index); return index > -1; }
/** * Removes from the underlying collection the last element returned by this iterator (optional operation). * This method can be called only once per call to next(). * The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method. * * @throws IllegalStateException - if the next() method has not yet been called, or the remove() method has already been called after the last call to the next() method */ public void remove() { if (state == State.NEXT_CALLED && index < indexEnd && indexEnd <= intBag.size()) { state = State.REMOVE_CALLED; intBag.remove(index); index--; indexEnd--; assert index < indexEnd; } else { throw new IllegalStateException(getErrorMessage(index)); } }
/** * Removes from the underlying collection the last element returned by this iterator (optional operation). * This method can be called only once per call to next(). * The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method. * * @throws IllegalStateException - if the next() method has not yet been called, or the remove() method has already been called after the last call to the next() method */ public void remove() { if (state == State.NEXT_CALLED && index < indexEnd && indexEnd <= intBag.size()) { state = State.REMOVE_CALLED; intBag.remove(index); index--; indexEnd--; assert index < indexEnd; } else { throw new IllegalStateException(getErrorMessage(index)); } }
/** * Unsubscribe T from entity. * * @param subscriber subscriber * @param entityId entity to subscribe */ public void unsubscribe(T subscriber, int entityId) { // unhook entity from subscriber IntBag entities = subscriberEntities.get(subscriber); if (entities != null) { int index = entities.indexOf(entityId); if ( index != -1 ) { entities.remove(index); } } // unhook subscriber from entity. Bag<T> subscribers = entitySubscribers.get(entityId); if (subscribers != null) { subscribers.remove(subscriber); } }
@Override public void validate(int sourceId, IntBag ids, LinkListener listener) { for (int i = 0; ids.size() > i; i++) { int id = ids.get(i); if (!all.getActiveEntityIds().unsafeGet(id)) { ids.remove(i--); if (listener != null) listener.onTargetDead(sourceId, id); } } }
@Override public void validate(int sourceId, IntBag ids, LinkListener listener) { for (int i = 0; ids.size() > i; i++) { int id = ids.get(i); if (!all.getActiveEntityIds().unsafeGet(id)) { ids.remove(i--); if (listener != null) listener.onTargetDead(sourceId, id); } } }
@Override public void validate(int sourceId, IntBag ids, LinkListener listener) { for (int i = 0; ids.size() > i; i++) { int id = ids.get(i); if (!all.getActiveEntityIds().unsafeGet(id)) { ids.remove(i--); if (listener != null) listener.onTargetDead(sourceId, id); } } }
@Override public void validate(int sourceId, IntBag ids, LinkListener listener) { for (int i = 0; ids.size() > i; i++) { int id = ids.get(i); if (!all.getActiveEntityIds().unsafeGet(id)) { ids.remove(i--); if (listener != null) listener.onTargetDead(sourceId, id); } } }