/** * Inserts the given <code>segment</code> into the trees. */ public void insert(ValueSegment<V,?> segment) { start.addInSortedOrder((byte)1, segment.getStart(), 1); end.addInSortedOrder((byte)1, segment.getEnd(), 1); }
/** * Inserts the given <code>segment</code> into the trees. */ public void insert(ValueSegment<V,?> segment) { start.addInSortedOrder((byte)1, segment.getStart(), 1); end.addInSortedOrder((byte)1, segment.getEnd(), 1); }
/** * Inserts the given <code>segment</code> into the trees. */ public void insert(ValueSegment<V,?> segment) { start.addInSortedOrder((byte)1, segment.getStart(), 1); end.addInSortedOrder((byte)1, segment.getEnd(), 1); }
/** * Inserts the specified unsorted node as the value in the sorted tree * and returns the sorted order. * * @return the sortIndex of the inserted object. */ private int insertByUnsortedNode(Element unsortedNode) { // add the object to the sorted set Element<Element> sortedNode = sorted.addInSortedOrder(ALL_COLORS, unsortedNode, 1); // assign the unsorted node the value of the sorted node unsortedNode.set(sortedNode); // return the sorted index return sorted.indexOfNode(sortedNode, ALL_COLORS); } /**
/** * Inserts the specified unsorted node as the value in the sorted tree * and returns the sorted order. * * @return the sortIndex of the inserted object. */ private int insertByUnsortedNode(Element unsortedNode) { // add the object to the sorted set Element<Element> sortedNode = sorted.addInSortedOrder(ALL_COLORS, unsortedNode, 1); // assign the unsorted node the value of the sorted node unsortedNode.set(sortedNode); // return the sorted index return sorted.indexOfNode(sortedNode, ALL_COLORS); } /**
/** * Inserts the specified unsorted node as the value in the sorted tree * and returns the sorted order. * * @return the sortIndex of the inserted object. */ private int insertByUnsortedNode(Element unsortedNode) { // add the object to the sorted set Element<Element> sortedNode = sorted.addInSortedOrder(ALL_COLORS, unsortedNode, 1); // assign the unsorted node the value of the sorted node unsortedNode.set(sortedNode); // return the sorted index return sorted.indexOfNode(sortedNode, ALL_COLORS); } /**
cache.remove(cacheNode); SparseListNode indexNode = agedNode.getIndexNode(); indexNode.setValue(cache.addInSortedOrder((byte)1, agedNode, 1)); SparseListNode indexNode = indexTree.getNode(index); AgedNode agedNode = new AgedNode(indexNode, value); indexNode.setValue(cache.addInSortedOrder((byte)1, agedNode, 1)); currentSize++;
cache.remove(cacheNode); SparseListNode indexNode = agedNode.getIndexNode(); indexNode.setValue(cache.addInSortedOrder((byte)1, agedNode, 1)); SparseListNode indexNode = indexTree.getNode(index); AgedNode agedNode = new AgedNode(indexNode, value); indexNode.setValue(cache.addInSortedOrder((byte)1, agedNode, 1)); currentSize++;
cache.remove(cacheNode); SparseListNode indexNode = agedNode.getIndexNode(); indexNode.setValue(cache.addInSortedOrder((byte)1, agedNode, 1)); SparseListNode indexNode = indexTree.getNode(index); AgedNode agedNode = new AgedNode(indexNode, value); indexNode.setValue(cache.addInSortedOrder((byte)1, agedNode, 1)); currentSize++;
private void processInsert(final int changeIndex, E inserted, boolean notify) { // This is a bit clunky - to find the group for an element, I am // creating a new GroupList and looking for it in the tree. GroupLists // are considered equal if their matchers compare equal. GroupMatcher<E> matcher = factory.createGroupMatcher(inserted); GroupList newGroup = new GroupList(matcher); int groupIndex = groupLists.indexOfValue(newGroup, true, false, (byte) 1); if (groupIndex >= 0) { insertHelper(changeIndex, groupIndex); if (notify) { GroupList groupingList = groupLists.get(groupIndex).get(); // an insert on the existing list groupingList.getListEventAssembler().elementInserted( groupingList.barcode.getBlackIndex(changeIndex), inserted); // an update on the grouping list updates.elementUpdated(groupIndex, groupingList, groupingList); } } else { Element<GroupList> newList = groupLists.addInSortedOrder((byte) 1, newGroup, 1); groupIndex = groupLists.indexOfNode(newList, (byte) 1); insertHelper(changeIndex, groupIndex); if (notify) { // begin event so later inserts, updates, deletes will work newGroup.getListEventAssembler().beginEvent(); // an update on the grouping list updates.elementInserted(groupIndex, newGroup); } } }