/** * Create a copy of this page. * * @param version the new version * @return a page with the given version */ public Page copy(long version) { Page newPage = create(map, version, keys, values, children, totalCount, memory); // mark the old as deleted removePage(); newPage.cachedCompare = cachedCompare; return newPage; }
/** * Remove this page and all child pages. */ void removeAllRecursive() { if (children != null) { for (int i = 0, size = map.getChildPageCount(this); i < size; i++) { PageReference ref = children[i]; if (ref.page != null) { ref.page.removeAllRecursive(); } else { long c = children[i].pos; int type = DataUtils.getPageType(c); if (type == DataUtils.PAGE_TYPE_LEAF) { int mem = DataUtils.getPageMaxLength(c); map.removePage(c, mem); } else { map.readPage(c).removeAllRecursive(); } } } } removePage(); }
/** * Remove a key-value pair, if the key exists. * * @param key the key (may not be null) * @return the old value if the key existed, or null otherwise */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { beforeWrite(); V result = get(key); if (result == null) { return null; } long v = writeVersion; synchronized (this) { Page p = root.copy(v); result = (V) remove(p, v, key); if (!p.isLeaf() && p.getTotalCount() == 0) { p.removePage(); p = Page.createEmpty(this, p.getVersion()); } newRoot(p); } return result; }
c.removePage(); } else { p.remove(index);
/** * Create a copy of this page. * * @param version the new version * @return a page with the given version */ public Page copy(long version) { Page newPage = create(map, version, keys, values, children, totalCount, memory); // mark the old as deleted removePage(); newPage.cachedCompare = cachedCompare; return newPage; }
/** * Create a copy of this page. * * @param version the new version * @return a page with the given version */ public Page copy(long version) { Page newPage = create(map, version, keys, values, children, totalCount, getMemory()); // mark the old as deleted removePage(); newPage.cachedCompare = cachedCompare; return newPage; }
/** * Create a copy of this page. * * @param version the new version * @return a page with the given version */ public Page copy(long version) { Page newPage = create(map, version, keys, values, children, totalCount, getMemory()); // mark the old as deleted removePage(); newPage.cachedCompare = cachedCompare; return newPage; }
/** * Remove this page and all child pages. */ void removeAllRecursive() { if (children != null) { for (int i = 0, size = map.getChildPageCount(this); i < size; i++) { PageReference ref = children[i]; if (ref.page != null) { ref.page.removeAllRecursive(); } else { long c = children[i].pos; int type = DataUtils.getPageType(c); if (type == DataUtils.PAGE_TYPE_LEAF) { int mem = DataUtils.getPageMaxLength(c); map.removePage(c, mem); } else { map.readPage(c).removeAllRecursive(); } } } } removePage(); }
/** * Remove this page and all child pages. */ void removeAllRecursive() { if (children != null) { for (int i = 0, size = map.getChildPageCount(this); i < size; i++) { PageReference ref = children[i]; if (ref.page != null) { ref.page.removeAllRecursive(); } else { long c = children[i].pos; int type = DataUtils.getPageType(c); if (type == DataUtils.PAGE_TYPE_LEAF) { int mem = DataUtils.getPageMaxLength(c); map.removePage(c, mem); } else { map.readPage(c).removeAllRecursive(); } } } } removePage(); }
/** * Remove this page and all child pages. */ void removeAllRecursive() { if (children != null) { for (int i = 0, size = map.getChildPageCount(this); i < size; i++) { PageReference ref = children[i]; if (ref.page != null) { ref.page.removeAllRecursive(); } else { long c = children[i].pos; int type = DataUtils.getPageType(c); if (type == DataUtils.PAGE_TYPE_LEAF) { int mem = DataUtils.getPageMaxLength(c); map.removePage(c, mem); } else { map.readPage(c).removeAllRecursive(); } } } } removePage(); }
/** * Remove a key-value pair, if the key exists. * * @param key the key (may not be null) * @return the old value if the key existed, or null otherwise */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { beforeWrite(); V result = get(key); if (result == null) { return null; } long v = writeVersion; synchronized (this) { Page p = root.copy(v); result = (V) remove(p, v, key); if (!p.isLeaf() && p.getTotalCount() == 0) { p.removePage(); p = Page.createEmpty(this, p.getVersion()); } newRoot(p); } return result; }
/** * Remove a key-value pair, if the key exists. * * @param key the key (may not be null) * @return the old value if the key existed, or null otherwise */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { beforeWrite(); V result = get(key); if (result == null) { return null; } long v = writeVersion; synchronized (this) { Page p = root.copy(v); result = (V) remove(p, v, key); if (!p.isLeaf() && p.getTotalCount() == 0) { p.removePage(); p = Page.createEmpty(this, p.getVersion()); } newRoot(p); } return result; }
/** * Remove a key-value pair, if the key exists. * * @param key the key (may not be null) * @return the old value if the key existed, or null otherwise */ @Override @SuppressWarnings("unchecked") public V remove(Object key) { beforeWrite(); V result = get(key); if (result == null) { return null; } long v = writeVersion; synchronized (this) { Page p = root.copy(v); result = (V) remove(p, v, key); if (!p.isLeaf() && p.getTotalCount() == 0) { p.removePage(); p = Page.createEmpty(this, p.getVersion()); } newRoot(p); } return result; }
c.removePage(); } else { p.remove(index);
c.removePage(); } else { p.remove(index);
c.removePage(); } else { p.remove(index);