/** {@inheritDoc} */ @Override public T0 remove(int index) { T0 removed = get(index); tree.remove(index, 1); return removed; }
/** {@inheritDoc} */ @Override public T0 remove(int index) { T0 removed = get(index); tree.remove(index, 1); return removed; }
/** {@inheritDoc} */ @Override public T0 remove(int index) { T0 removed = get(index); tree.remove(index, 1); return removed; }
/** * Replace all values at the specified index with the specified new value. * * <p>Currently this uses a naive implementation of remove then add. If * it proves desirable, it may be worthwhile to optimize this implementation * with one that performs the remove and insert simultaneously, to save * on tree navigation. * * @return the element that was updated. This is non-null unless the size * parameter is 0, in which case the result is always <code>null</code>. */ public Element<T0> set(int index, T0 value, int size) { remove(index, size); return add(index, value, size); }
/** * Replace all values at the specified index with the specified new value. * * <p>Currently this uses a naive implementation of remove then add. If * it proves desirable, it may be worthwhile to optimize this implementation * with one that performs the remove and insert simultaneously, to save * on tree navigation. * * @return the element that was updated. This is non-null unless the size * parameter is 0, in which case the result is always <code>null</code>. */ public Element<T0> set(int index, T0 value, int size) { remove(index, size); return add(index, value, size); }
/** * Replace all values at the specified index with the specified new value. * * <p>Currently this uses a naive implementation of remove then add. If * it proves desirable, it may be worthwhile to optimize this implementation * with one that performs the remove and insert simultaneously, to save * on tree navigation. * * @return the element that was updated. This is non-null unless the size * parameter is 0, in which case the result is always <code>null</code>. */ public Element<T0> set(int index, T0 value, int size) { remove(index, size); return add(index, value, size); }
/** * Removes the <code>segment</code> from the trees. */ public void delete(ValueSegment<V,?> segment) { int startIndex = start.indexOfValue(segment.getStart(), true, false, (byte)1); int endIndex = end.indexOfValue(segment.getEnd(), true, false, (byte)1); start.remove(startIndex, 1); end.remove(endIndex, 1); }
/** * Removes the <code>segment</code> from the trees. */ public void delete(ValueSegment<V,?> segment) { int startIndex = start.indexOfValue(segment.getStart(), true, false, (byte)1); int endIndex = end.indexOfValue(segment.getEnd(), true, false, (byte)1); start.remove(startIndex, 1); end.remove(endIndex, 1); }
/** * Removes the <code>segment</code> from the trees. */ public void delete(ValueSegment<V,?> segment) { int startIndex = start.indexOfValue(segment.getStart(), true, false, (byte)1); int endIndex = end.indexOfValue(segment.getEnd(), true, false, (byte)1); start.remove(startIndex, 1); end.remove(endIndex, 1); }
/** * Deletes the node in the sorted tree based on the value of the specified * unsorted tree node. * * @return the sortIndex of the deleted object. */ private int deleteByUnsortedNode(Element unsortedNode) { // get the sorted node Element sortedNode = (Element)unsortedNode.get(); // look up the sorted index before removing the nodes int sortedIndex = sorted.indexOfNode(sortedNode, ALL_COLORS); // delete the sorted node from its tree sorted.remove(sortedIndex, 1); // return the sorted index return sortedIndex; }
/** * Deletes the node in the sorted tree based on the value of the specified * unsorted tree node. * * @return the sortIndex of the deleted object. */ private int deleteByUnsortedNode(Element unsortedNode) { // get the sorted node Element sortedNode = (Element)unsortedNode.get(); // look up the sorted index before removing the nodes int sortedIndex = sorted.indexOfNode(sortedNode, ALL_COLORS); // delete the sorted node from its tree sorted.remove(sortedIndex, 1); // return the sorted index return sortedIndex; }
/** * Deletes the node in the sorted tree based on the value of the specified * unsorted tree node. * * @return the sortIndex of the deleted object. */ private int deleteByUnsortedNode(Element unsortedNode) { // get the sorted node Element sortedNode = (Element)unsortedNode.get(); // look up the sorted index before removing the nodes int sortedIndex = sorted.indexOfNode(sortedNode, ALL_COLORS); // delete the sorted node from its tree sorted.remove(sortedIndex, 1); // return the sorted index return sortedIndex; }
while (i.hasNext()) { Integer remIndex = i.next(); groupLists.remove(remIndex, 1); updates.elementDeleted(remIndex, j.next());
/** * Helper for {@link #listChanged(ListEvent)} when deleting. */ private void handleDelete(int sourceIndex) { // find the index of the black node with that index final int parentIndex = getAbsoluteIndex(sourceIndex); final int nextParentIndex = getAbsoluteIndex(sourceIndex + 1); final int childCount = nextParentIndex - parentIndex - 1; // subtract one for the parent // record the delete events first while the deleted values still exist if(childCount > 0) { int firstDeletedChildIndex = parentIndex - sourceIndex; int firstNotDeletedChildIndex = firstDeletedChildIndex + childCount; for (int i = firstDeletedChildIndex; i < firstNotDeletedChildIndex; i++) { updates.elementDeleted(firstDeletedChildIndex, get(i)); } } // update the list of child lists Element<ChildElement<E>> removedChildElement = childElements.get(sourceIndex); childElements.remove(removedChildElement); removedChildElement.get().dispose(); // update the barcode barcode.remove(parentIndex, 1 + childCount); // delete the parent and all children }
/** * Helper for {@link #listChanged(ListEvent)} when deleting. */ private void handleDelete(int sourceIndex) { // find the index of the black node with that index final int parentIndex = getAbsoluteIndex(sourceIndex); final int nextParentIndex = getAbsoluteIndex(sourceIndex + 1); final int childCount = nextParentIndex - parentIndex - 1; // subtract one for the parent // record the delete events first while the deleted values still exist if(childCount > 0) { int firstDeletedChildIndex = parentIndex - sourceIndex; int firstNotDeletedChildIndex = firstDeletedChildIndex + childCount; for (int i = firstDeletedChildIndex; i < firstNotDeletedChildIndex; i++) { updates.elementDeleted(firstDeletedChildIndex, get(i)); } } // update the list of child lists Element<ChildElement<E>> removedChildElement = childElements.get(sourceIndex); childElements.remove(removedChildElement); removedChildElement.get().dispose(); // update the barcode barcode.remove(parentIndex, 1 + childCount); // delete the parent and all children }
/** * Helper for {@link #listChanged(ListEvent)} when deleting. */ private void handleDelete(int sourceIndex) { // find the index of the black node with that index final int parentIndex = getAbsoluteIndex(sourceIndex); final int nextParentIndex = getAbsoluteIndex(sourceIndex + 1); final int childCount = nextParentIndex - parentIndex - 1; // subtract one for the parent // record the delete events first while the deleted values still exist if(childCount > 0) { int firstDeletedChildIndex = parentIndex - sourceIndex; int firstNotDeletedChildIndex = firstDeletedChildIndex + childCount; for (int i = firstDeletedChildIndex; i < firstNotDeletedChildIndex; i++) { updates.elementDeleted(firstDeletedChildIndex, get(i)); } } // update the list of child lists Element<ChildElement<E>> removedChildElement = childElements.get(sourceIndex); childElements.remove(removedChildElement); removedChildElement.get().dispose(); // update the barcode barcode.remove(parentIndex, 1 + childCount); // delete the parent and all children }
AgedNode agedNode = (AgedNode)cacheNode.get(); value = agedNode.getValue(); cache.remove(cacheNode); SparseListNode indexNode = agedNode.getIndexNode(); indexNode.setValue(cache.addInSortedOrder((byte)1, agedNode, 1)); cache.remove(oldestInCache); AgedNode oldAgedNode = (AgedNode)oldestInCache.get(); SparseListNode oldIndexNode = oldAgedNode.getIndexNode();