/** * Split the page. This modifies the current page. * * @param at the split index * @return the page with the entries after the split index */ Page split(int at) { Page page = isLeaf() ? splitLeaf(at) : splitNode(at); if(isPersistent()) { recalculateMemory(); } return page; }
p.memory = IN_MEMORY; } else if (memory == 0) { p.recalculateMemory(); } else { p.addMemory(memory);
totalCount = len; recalculateMemory();
private Page splitLeaf(int at) { int a = at, b = keys.length - a; Object[] aKeys = new Object[a]; Object[] bKeys = new Object[b]; System.arraycopy(keys, 0, aKeys, 0, a); System.arraycopy(keys, a, bKeys, 0, b); keys = aKeys; Object[] aValues = new Object[a]; Object[] bValues = new Object[b]; bValues = new Object[b]; System.arraycopy(values, 0, aValues, 0, a); System.arraycopy(values, a, bValues, 0, b); values = aValues; totalCount = a; Page newPage = create(map, version, bKeys, bValues, null, bKeys.length, 0); recalculateMemory(); newPage.recalculateMemory(); return newPage; }
private Page splitLeaf(int at) { int a = at, b = keys.length - a; Object[] aKeys = new Object[a]; Object[] bKeys = new Object[b]; System.arraycopy(keys, 0, aKeys, 0, a); System.arraycopy(keys, a, bKeys, 0, b); keys = aKeys; Object[] aValues = new Object[a]; Object[] bValues = new Object[b]; bValues = new Object[b]; System.arraycopy(values, 0, aValues, 0, a); System.arraycopy(values, a, bValues, 0, b); values = aValues; totalCount = a; Page newPage = create(map, version, bKeys, bValues, null, bKeys.length, 0); recalculateMemory(); newPage.recalculateMemory(); return newPage; }
private Page splitNode(int at) { int a = at, b = keys.length - a; Object[] aKeys = new Object[a]; Object[] bKeys = new Object[b - 1]; System.arraycopy(keys, 0, aKeys, 0, a); System.arraycopy(keys, a + 1, bKeys, 0, b - 1); keys = aKeys; PageReference[] aChildren = new PageReference[a + 1]; PageReference[] bChildren = new PageReference[b]; System.arraycopy(children, 0, aChildren, 0, a + 1); System.arraycopy(children, a + 1, bChildren, 0, b); children = aChildren; long t = 0; for (PageReference x : aChildren) { t += x.count; } totalCount = t; t = 0; for (PageReference x : bChildren) { t += x.count; } Page newPage = create(map, version, bKeys, null, bChildren, t, 0); recalculateMemory(); newPage.recalculateMemory(); return newPage; }
private Page splitNode(int at) { int a = at, b = keys.length - a; Object[] aKeys = new Object[a]; Object[] bKeys = new Object[b - 1]; System.arraycopy(keys, 0, aKeys, 0, a); System.arraycopy(keys, a + 1, bKeys, 0, b - 1); keys = aKeys; PageReference[] aChildren = new PageReference[a + 1]; PageReference[] bChildren = new PageReference[b]; System.arraycopy(children, 0, aChildren, 0, a + 1); System.arraycopy(children, a + 1, bChildren, 0, b); children = aChildren; long t = 0; for (PageReference x : aChildren) { t += x.count; } totalCount = t; t = 0; for (PageReference x : bChildren) { t += x.count; } Page newPage = create(map, version, bKeys, null, bChildren, t, 0); recalculateMemory(); newPage.recalculateMemory(); return newPage; }
/** * Split the page. This modifies the current page. * * @param at the split index * @return the page with the entries after the split index */ Page split(int at) { Page page = isLeaf() ? splitLeaf(at) : splitNode(at); if(isPersistent()) { recalculateMemory(); } return page; }
p.totalCount = totalCount; if (memory == 0) { p.recalculateMemory(); } else { p.addMemory(memory);
p.totalCount = totalCount; if (memory == 0) { p.recalculateMemory(); } else { p.addMemory(memory);
p.memory = IN_MEMORY; } else if (memory == 0) { p.recalculateMemory(); } else { p.addMemory(memory);
totalCount = len; recalculateMemory();
totalCount = len; recalculateMemory();
totalCount = len; recalculateMemory();