Changeset 19678
- Timestamp:
- 02/08/12 18:11:17 (4 months ago)
- Location:
- trunk/Jav_Orient
- Files:
-
- 1 added
- 15 edited
-
src/eu/scenari/orient/recordstruct/lib/tree/ValueTree.java (modified) (4 diffs)
-
src/eu/scenari/orient/recordstruct/lib/tree/ValueTreeNode.java (modified) (3 diffs)
-
src/eu/scenari/orient/recordstruct/lib/tree/ValueTreeRake.java (modified) (3 diffs)
-
src/eu/scenari/orient/recordstruct/lib/tree/ValueTreeSlotKV.java (modified) (3 diffs)
-
src/eu/scenari/orient/recordstruct/value/ValueListImmutableFixed.java (modified) (1 diff)
-
src/eu/scenari/orient/tree/impl/BalancedLayout.java (modified) (2 diffs)
-
src/eu/scenari/orient/tree/impl/Tree.java (modified) (1 diff)
-
src/eu/scenari/orient/tree/impl/TreeNode.java (modified) (1 diff)
-
src/eu/scenari/orient/tree/impl/TreeRake.java (modified) (1 diff)
-
src/eu/scenari/orient/tree/impl/TreeSlot.java (modified) (2 diffs)
-
src/eu/scenari/orient/tree/provider/ITreeProvider.java (modified) (3 diffs)
-
test/eu/scenari/orient/tree/FactorySequentialLong.java (modified) (4 diffs)
-
test/eu/scenari/orient/tree/FactorySequentialLongTest.java (added)
-
test/eu/scenari/orient/tree/IKeyFactory.java (modified) (1 diff)
-
test/eu/scenari/orient/tree/TreeBasicTest.java (modified) (5 diffs)
-
test/eu/scenari/orient/tree/perf/MVRBTreePerfTest.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Jav_Orient/src/eu/scenari/orient/recordstruct/lib/tree/ValueTree.java
r19672 r19678 92 92 fStruct = pStruct; 93 93 fRootEntry = pReader.getAsValue(); 94 fSize = getTreeStorageConfig().isSizeStored() ? pReader.getAsInteger() : -1; 94 fSize = pReader.getAsInteger(); 95 if (!getTreeStorageConfig().isSizeStored()) fSize = SIZE_UNKNOWN; 95 96 fPojo = new Tree(this, getTreeStorageConfig().getKeyComparator(), getTreeStorageConfig().getBalancingLayout()); 96 97 } … … 111 112 112 113 public void setSizeByDelta(int pDelta) { 114 if (fSize == SIZE_UNKNOWN) return; 113 115 fSize += pDelta; 114 116 if (getTreeStorageConfig().isSizeStored()) { … … 204 206 ((IRecordStructInternal) getRecord()).addSubRecordDirty(this); 205 207 } 208 assert (!fNodesToSave.contains(pNode)); 206 209 fNodesToSave.add(pNode); 207 210 } … … 209 212 /** Called by rakes and slots. */ 210 213 public void addNodeToDelete(IRecordStruct<?> pNode) { 211 if ( pNode.isDirty() &&fNodesToSave != null) {214 if (fNodesToSave != null) { 212 215 for (int i = 0; i < fNodesToSave.size(); i++) { 213 216 if (fNodesToSave.get(i) == pNode) { -
trunk/Jav_Orient/src/eu/scenari/orient/recordstruct/lib/tree/ValueTreeNode.java
r19672 r19678 43 43 import eu.scenari.orient.recordstruct.IValueList; 44 44 import eu.scenari.orient.recordstruct.IValueOwner; 45 import eu.scenari.orient.recordstruct.impl.StructReader;46 45 import eu.scenari.orient.recordstruct.value.ValueUpdatableAbstract; 47 46 import eu.scenari.orient.tree.provider.ITreeNodeProvider; … … 59 58 } 60 59 61 public ValueTreeNode( StructReader pReader, IValueOwner pOwner) {62 super(pOwner, false);60 public ValueTreeNode(IValueOwner pOwner, boolean pIsDirty) { 61 super(pOwner, pIsDirty); 63 62 } 64 63 … … 79 78 } 80 79 80 public void deleteNode() { 81 fTree.addNodeToDelete(this.getRecord()); 82 fKeys.clear(); 83 } 84 81 85 // ############# 82 86 -
trunk/Jav_Orient/src/eu/scenari/orient/recordstruct/lib/tree/ValueTreeRake.java
r19672 r19678 71 71 72 72 public ValueTreeRake(StructReader pReader, IValueOwner pOwner) { 73 super(pReader, pOwner); 73 super(pOwner, false); 74 pReader.pushOwner(this); 74 75 fKeys = pReader.getAsValue(); 75 76 fSubNodes = pReader.getAsValue(); 77 pReader.popOwner(); 76 78 } 77 79 … … 143 145 } 144 146 145 public void deleteNode() {146 fTree.addNodeToDelete(this.getRecord());147 //free mem148 fKeys = null;149 fSubNodes = null;150 }151 152 147 // ############# 153 148 … … 187 182 } 188 183 184 public void deleteNode() { 185 super.deleteNode(); 186 fSubNodes.clear(); 187 } 188 189 189 // ############# 190 190 -
trunk/Jav_Orient/src/eu/scenari/orient/recordstruct/lib/tree/ValueTreeSlotKV.java
r19672 r19678 65 65 66 66 public ValueTreeSlotKV(StructReader pReader, IValueOwner pOwner) { 67 super(pReader, pOwner); 67 super(pOwner, false); 68 pReader.pushOwner(this); 68 69 fKeys = pReader.getAsValue(); 69 70 fValues = pReader.getAsValue(); 71 pReader.popOwner(); 70 72 } 71 73 … … 137 139 } 138 140 139 public void deleteNode() {140 fTree.addNodeToDelete(this.getRecord());141 //free mem142 fKeys = null;143 fValues = null;144 }145 146 141 // ############# 147 142 … … 161 156 fValues.set(pOffset, pValue); 162 157 return true; 158 } 159 160 public void deleteNode() { 161 super.deleteNode(); 162 fValues.clear(); 163 163 } 164 164 -
trunk/Jav_Orient/src/eu/scenari/orient/recordstruct/value/ValueListImmutableFixed.java
r19674 r19678 332 332 isolateBufferForUpdates(fSize - 1); 333 333 int vOffset = index2Offset(pIndex); 334 System.arraycopy(fRawEntries, vOffset + getFixedLengthEntry(), fRawEntries, vOffset, ( pIndex - fSize- 1) * getFixedLengthEntry());334 System.arraycopy(fRawEntries, vOffset + getFixedLengthEntry(), fRawEntries, vOffset, (fSize - pIndex - 1) * getFixedLengthEntry()); 335 335 } else { 336 336 setDirty(); -
trunk/Jav_Orient/src/eu/scenari/orient/tree/impl/BalancedLayout.java
r19675 r19678 149 149 if (pNode.fParent != null && pNode.fProvider.getFillRate() < fOptimizeThreshold) { 150 150 //pNode become too empty, try to merge with a neighbour 151 tryToDelete(pNode); 151 if (pNode.isRake()) { 152 tryToDeleteRake((TreeRake<K, V>) pNode); 153 } else { 154 tryToDeleteSlot((TreeSlot<K, V>) pNode); 155 } 152 156 } 153 157 } … … 157 161 } 158 162 159 protected <K, V> void tryToDelete(TreeNode<K, V> pNode) { 160 TreeRake<K, V> vParent = pNode.fParent; 161 int vOffset = pNode.getOffsetInParent(); 162 if (vOffset > 0) { 163 TreeNode<K, V> vPreviousNode = vParent.getNodeIfLoaded(vOffset - 1); 164 if (vPreviousNode != null && vPreviousNode.getProvider().getFillRate() < fFillingThreshold && pNode.isRake() == vPreviousNode.isRake()) { 165 //Try to merge 166 if (vPreviousNode.adoptAllEntriesFromRight(pNode)) { 167 pNode.deleteNode(); 168 return; 169 } 170 } 171 } 172 int vIndexLastSlotInRake = vParent.getProvider().getSize() - 1; 173 if (vOffset < vIndexLastSlotInRake) { 174 TreeNode<K, V> vNextNode = vParent.getNodeIfLoaded(vOffset + 1); 175 if (vNextNode != null && vNextNode.getProvider().getFillRate() < fFillingThreshold && pNode.isRake() == vNextNode.isRake()) { 176 //Try to merge 177 if (vNextNode.adoptAllEntriesFromLeft(pNode)) { 178 pNode.deleteNode(); 179 return; 180 } 181 } 182 } 183 if (vOffset == 0) { 184 //TODO Try with previous slot in the previous rake. 185 } 186 if (vOffset == vIndexLastSlotInRake) { 187 //TODO Try with next slot in the next rake. 163 protected <K, V> void tryToDeleteSlot(TreeSlot<K, V> pNode) { 164 TreeSlot<K, V> vLeftNode = pNode.findLeftSlot(); 165 if (vLeftNode != null && vLeftNode.getProvider().getFillRate() < fFillingThreshold) { 166 //Try to merge 167 if (vLeftNode.adoptAllEntriesFromRight(pNode)) { 168 pNode.deleteNode(); 169 return; 170 } 171 } 172 TreeSlot<K, V> vRightNode = pNode.findRightSlot(); 173 if (vRightNode != null && vRightNode.getProvider().getFillRate() < fFillingThreshold) { 174 //Try to merge 175 if (vRightNode.adoptAllEntriesFromLeft(pNode)) { 176 pNode.deleteNode(); 177 return; 178 } 179 } 180 } 181 182 protected <K, V> void tryToDeleteRake(TreeRake<K, V> pNode) { 183 TreeNode<K, V> vLeftNode = pNode.fParent.findLeftCousin(pNode.getOffsetInParent()); 184 if (vLeftNode != null && vLeftNode.getProvider().getFillRate() < fFillingThreshold && vLeftNode.isRake()) { 185 //Try to merge 186 if (vLeftNode.adoptAllEntriesFromRight(pNode)) { 187 pNode.deleteNode(); 188 return; 189 } 190 } 191 TreeNode<K, V> vRightNode = pNode.fParent.findRightCousin(pNode.getOffsetInParent()); 192 if (vRightNode != null && vRightNode.getProvider().getFillRate() < fFillingThreshold && vRightNode.isRake()) { 193 //Try to merge 194 if (vRightNode.adoptAllEntriesFromLeft(pNode)) { 195 pNode.deleteNode(); 196 return; 197 } 188 198 } 189 199 } -
trunk/Jav_Orient/src/eu/scenari/orient/tree/impl/Tree.java
r19675 r19678 222 222 } 223 223 224 public boolean isEmpty() { 225 int vSize = fProvider.getSize(); 226 if (vSize > 0) return false; 227 if (vSize == 0) return true; 228 //Size unknown 229 TreeSlot<K, V> vSlot = findFirstSlot(); 230 while (vSlot != null && vSlot.getSize() == 0) { 231 vSlot = vSlot.findRightSlot(); 232 } 233 return vSlot == null; 234 } 235 224 236 public Set<Entry<K, V>> entrySet() { 225 237 final EntrySet vResult = fEntrySet; -
trunk/Jav_Orient/src/eu/scenari/orient/tree/impl/TreeNode.java
r19674 r19678 60 60 61 61 public void deleteNode() { 62 // remove form parent63 62 if (fParent != null) { 63 // remove from parent 64 64 fParent.removeChildNode(this); 65 } else {66 fTree.fBalancingLayout.onRemovedEntry(this);67 65 } 68 66 // Delete this node. -
trunk/Jav_Orient/src/eu/scenari/orient/tree/impl/TreeRake.java
r19674 r19678 257 257 public void removeChildNode(TreeNode pEntry) { 258 258 assert (pEntry.fParent == this); 259 int vOffsetEntry = pEntry.getOffsetInParent(); 260 if (vOffsetEntry == 0 && fProvider.getSize() == 1) { 261 // Last entry in this slot, cleanup 259 int vOldSize = fProvider.getSize(); 260 if (vOldSize == 1) { 261 assert (pEntry.getOffsetInParent() == 0); 262 // Last entry in this rake, cleanup 262 263 if (fParent != null) { 263 fParent.removeChildNode(this);264 deleteNode(); 264 265 } else { 265 266 // We are the root, no more entries, we ref the last empty slot as root. 266 TreeSlot vSlot = pEntry.findFirstSlot();267 TreeSlot<K, V> vSlot = pEntry.findFirstSlot(); 267 268 vSlot.setParent(null, 0); 269 vSlot.clear(); 268 270 fTree.setRoot(vSlot); 269 }270 if (pEntry.fParent == this) {271 // Delete the entry if it has not been setted elsewhere.272 pEntry.fProvider.deleteNode();273 271 } 274 272 } else { 275 273 // Remove this entry. 274 int vOffsetEntry = pEntry.getOffsetInParent(); 275 assert (vOffsetEntry < vOldSize); 276 for (int i = vOffsetEntry; i < vOldSize - 1; i++) { 277 TreeNode<K, V> vNext = fChildren[i + 1]; 278 fChildren[i] = vNext; 279 vNext.setParent(this, i); 280 } 281 fChildren[vOldSize - 1] = null; 276 282 fProvider.remove(vOffsetEntry); 277 283 // Update start key. -
trunk/Jav_Orient/src/eu/scenari/orient/tree/impl/TreeSlot.java
r19675 r19678 93 93 94 94 public void removeEntry(int pOffset) { 95 assert (pOffset > 0 && pOffset < getProvider().getSize());96 if (pOffset == 0 && fProvider.getSize() == 1 ) {95 assert (pOffset >= 0 && pOffset < getProvider().getSize()); 96 if (pOffset == 0 && fProvider.getSize() == 1 && fParent != null) { 97 97 //cleanup 98 98 deleteNode(); … … 103 103 } 104 104 fTree.fBalancingLayout.onRemovedEntry(this); 105 } 106 } 107 108 /** Called when this is last slot and setted on tree root. */ 109 public void clear() { 110 for (int i = getSize() - 1; i >= 0; i--) { 111 fProvider.remove(i); 105 112 } 106 113 } -
trunk/Jav_Orient/src/eu/scenari/orient/tree/provider/ITreeProvider.java
r19672 r19678 2 2 3 3 public interface ITreeProvider<K, V> { 4 5 public static int SIZE_UNKNOWN = -1; 4 6 5 7 /** … … 7 9 * A provider can not store the current size and then return -1. 8 10 * 9 * @return tree size or -1if size unknown.11 * @return tree size or {@link #SIZE_UNKNOWN} if size unknown. 10 12 */ 11 13 public int getSize(); … … 17 19 18 20 /** 19 * Set size.20 * Can be called when {@link #getSize()} has returned -1and the size21 * Set computed size. 22 * Can be called when {@link #getSize()} has returned {@link #SIZE_UNKNOWN} and the size 21 23 * has been computed by iterating the tree. 22 * The size should then be kept in memory for performance.24 * The size should then be kept and updated in memory for performance. 23 25 */ 24 26 public void setSize(int pComputedSize); -
trunk/Jav_Orient/test/eu/scenari/orient/tree/FactorySequentialLong.java
r19675 r19678 7 7 import junit.framework.Assert; 8 8 import eu.scenari.commons.util.collections.IteratorBufferedNextBase; 9 import eu.scenari.commons.util.lang.ScException; 9 10 10 11 public class FactorySequentialLong implements IKeyFactory<Long>, IValueFactory<Long> { … … 16 17 protected AtomicLong fCounter = new AtomicLong(fStartValue); 17 18 19 protected UnorderedIterator fRemovedKeys; 20 21 public class UnorderedIterator extends IteratorBufferedNextBase<Long> { 22 23 protected int fBase; 24 25 protected long fSize; 26 27 protected long fCurrentStep = 0; 28 29 protected long fCurrentModulo = 0; 30 31 public UnorderedIterator(int pSizeStep) { 32 fBase = pSizeStep; 33 fSize = fCounter.get(); 34 } 35 36 public boolean hasNext() { 37 //Si le suivant a déjà été trouvé, il doit d'abord etre lu par next(). 38 if (fNext != null) return true; 39 //Cherche à renseigner fNext 40 do { 41 while (fCurrentModulo < fBase) { 42 long vNext = fStartValue + fCurrentStep + fCurrentModulo; 43 if (vNext < fSize) { 44 fNext = vNext; 45 fCurrentStep += fBase; 46 break; 47 } else { 48 fCurrentModulo++; 49 fCurrentStep = 0; 50 } 51 } 52 if (fNext != null && fRemovedKeys != null && fRemovedKeys != this && fRemovedKeys.isAlreadyReturned(fNext)) { 53 fNext = null; 54 } else { 55 break; 56 } 57 } while (true); 58 return (fNext != null); 59 } 60 61 public boolean isAlreadyReturned(Long pEntry) { 62 long vModulo = (pEntry.longValue() - fStartValue) % (long) fBase; 63 if (vModulo > fCurrentModulo) return false; 64 if (vModulo < fCurrentModulo) return true; 65 long vStep = (pEntry.longValue() - fStartValue) / (long) fBase; 66 return (vStep * fBase) < fCurrentStep; 67 } 68 69 } 70 18 71 public Long newKey() { 72 if (fRemovedKeys != null) throw new ScException("Removes keys is started, create new keys not allowed."); 19 73 return fCounter.getAndIncrement(); 20 74 } … … 25 79 26 80 public Iterator<Long> unorderedIterator() { 27 return n ull;81 return new UnorderedIterator(27); 28 82 } 29 83 … … 36 90 if (fNext != null) return true; 37 91 //Cherche à renseigner fNext 38 if(fLast < fCounter.get()) {92 while (fLast < fCounter.get()) { 39 93 fNext = fLast++; 94 if (fRemovedKeys != null && fRemovedKeys.isAlreadyReturned(fNext)) { 95 fNext = null; 96 } else { 97 break; 98 } 40 99 } 41 100 return (fNext != null); 42 101 } 43 102 }; 103 } 104 105 public Long getUnorderedKeyToRemove() { 106 if (fRemovedKeys == null) fRemovedKeys = new UnorderedIterator(37); 107 return fRemovedKeys.hasNext() ? fRemovedKeys.next() : null; 44 108 } 45 109 -
trunk/Jav_Orient/test/eu/scenari/orient/tree/IKeyFactory.java
r19672 r19678 7 7 public K newKey(); 8 8 9 public K peekRandomKey();9 public Iterator<K> creationOrderIterator(); 10 10 11 11 public Iterator<K> unorderedIterator(); 12 12 13 public Iterator<K> creationOrderIterator(); 13 public K peekRandomKey(); 14 15 public K getUnorderedKeyToRemove(); 16 14 17 } -
trunk/Jav_Orient/test/eu/scenari/orient/tree/TreeBasicTest.java
r19675 r19678 59 59 public class TreeBasicTest extends TestDbAbstract { 60 60 61 public static final TreeStorageConfig TREECONFIG = new TreeStorageConfig().setKeysStruct(TypesBase.LIST_LONG).setValuesStruct(TypesBase.LIST_LONG).setSizeStored(false).setBalancingLayout(IBalancingLayout.DEFAULT_BALANCED_INCREMENTAL_INSERT) 62 .setRakeCapacity(256).setSlotCapacity(256); 61 public static int MAP_SIZE = 2000; 62 63 public static boolean STORE_SIZE = false; 64 65 public static final TreeStorageConfig TREECONFIG = new TreeStorageConfig().setKeysStruct(TypesBase.LIST_LONG).setValuesStruct(TypesBase.LIST_LONG).setSizeStored(STORE_SIZE).setBalancingLayout(IBalancingLayout.DEFAULT_BALANCED_INCREMENTAL_INSERT) 66 .setRakeCapacity(32).setSlotCapacity(32); 63 67 64 68 public static final StructTree TREE_LONG_LONG = new StructTree(new ExtendedStructId(1, 1), "trreeLongLong").setTreeConfig(TREECONFIG); … … 72 76 @Test 73 77 public void test1() { 74 int vSize = 200000;78 int vSize = MAP_SIZE; 75 79 fDatabase = fDbDriver.acquireDatabase(); 76 80 IRecordStruct<ValueTree<Long, Long>> vRecord = fDatabase.newInstance(); … … 79 83 ORID vId = vRecord.getIdentity(); 80 84 85 //Inserts 81 86 Map<Long, Long> vTree = vRecord.getValue().getPojo(); 82 87 for (int i = 1; i <= vSize; i++) { … … 84 89 vTree.put(vKey, fFactorySeqLong.newValueFor(vKey)); 85 90 vRecord.save(); 86 Assert.assertEquals(i, vTree.size());91 checkSize(vTree, i); 87 92 } 88 Assert.assertEquals(vSize, vTree.size()); 93 checkSize(vTree, vSize); 94 checkEntrySetIterator(vTree); 89 95 checkAllEntries(vTree); 90 96 97 //Sequential access 91 98 forceNewDatabase(); 92 99 vRecord = fDatabase.load(vId); 93 100 vTree = vRecord.getValue().getPojo(); 94 Assert.assertEquals(vSize, vTree.size());101 checkSize(vTree, vSize); 95 102 checkAllEntries(vTree); 96 103 104 //Unordered access 105 forceNewDatabase(); 106 vRecord = fDatabase.load(vId); 107 vTree = vRecord.getValue().getPojo(); 108 for (Iterator<Long> vIt = fFactorySeqLong.unorderedIterator(); vIt.hasNext();) { 109 Long vKey = vIt.next(); 110 fFactorySeqLong.checkValueForKey(vKey, vTree.get(vKey)); 111 } 112 113 //Remove entries 114 forceNewDatabase(); 115 vRecord = fDatabase.load(vId); 116 vTree = vRecord.getValue().getPojo(); 117 Long vKey = fFactorySeqLong.getUnorderedKeyToRemove(); 118 while (vKey != null) { 119 //System.out.println(vKey); 120 vTree.remove(vKey); 121 vRecord.save(); 122 // forceNewDatabase(); 123 // vRecord = fDatabase.load(vId); 124 // vTree = vRecord.getValue().getPojo(); 125 // checkSize(vTree, --vSize); 126 // checkAllEntries(vTree); 127 vKey = fFactorySeqLong.getUnorderedKeyToRemove(); 128 } 129 Assert.assertTrue(vTree.isEmpty()); 97 130 } 98 131 99 protected void checkAllEntries(Map<Long, Long> pTree) { 132 protected void checkSize(Map<Long, Long> pTree, int pSize) { 133 if (STORE_SIZE) { 134 Assert.assertEquals(pTree.size(), pSize); 135 } 136 } 137 138 protected void checkEntrySetIterator(Map<Long, Long> pTree) { 100 139 int vCount = 0; 101 140 for (Map.Entry<Long, Long> vEntry : pTree.entrySet()) { … … 103 142 vCount++; 104 143 } 105 Assert.assertEquals(pTree.size(), vCount); 144 checkSize(pTree, vCount); 145 } 146 147 protected void checkAllEntries(Map<Long, Long> pTree) { 148 int vCount = 0; 106 149 for (Iterator<Long> vIt = fFactorySeqLong.creationOrderIterator(); vIt.hasNext();) { 107 150 Long vKey = vIt.next(); 108 151 fFactorySeqLong.checkValueForKey(vKey, pTree.get(vKey)); 152 vCount++; 109 153 } 154 checkSize(pTree, vCount); 110 155 111 156 } -
trunk/Jav_Orient/test/eu/scenari/orient/tree/perf/MVRBTreePerfTest.java
r19675 r19678 17 17 18 18 public class MVRBTreePerfTest extends TestDbAbstract { 19 public static int MAP_SIZE = 20000; 19 20 20 21 protected FactorySequentialLong fFactorySeqLong = new FactorySequentialLong(); … … 26 27 @Test 27 28 public void test1() { 28 int vSize = 200000;29 int vSize = MAP_SIZE; 29 30 fDatabase = fDbDriver.acquireDatabase(); 30 31 … … 38 39 vTree.put(vKey, fFactorySeqLong.newValueFor(vKey)); 39 40 vTree.lazySave(); 40 Assert.assertEquals(i, vTree.size());41 checkSize(vTree, i); 41 42 } 42 Assert.assertEquals(vSize, vTree.size());43 checkSize(vTree, vSize); 43 44 checkAllEntries(vTree); 44 45 … … 46 47 vTree = new OMVRBTreeDatabaseLazySave<Long, Long>(fDatabase, vId); 47 48 vTree.load(); 48 Assert.assertEquals(vSize, vTree.size());49 checkSize(vTree, vSize); 49 50 checkAllEntries(vTree); 51 52 forceNewDatabase(); 53 vTree = new OMVRBTreeDatabaseLazySave<Long, Long>(fDatabase, vId); 54 vTree.load(); 55 for (Iterator<Long> vIt = fFactorySeqLong.unorderedIterator(); vIt.hasNext();) { 56 Long vKey = vIt.next(); 57 fFactorySeqLong.checkValueForKey(vKey, vTree.get(vKey)); 58 } 59 60 //Remove entries 61 forceNewDatabase(); 62 vTree = new OMVRBTreeDatabaseLazySave<Long, Long>(fDatabase, vId); 63 vTree.load(); 64 Long vKey = fFactorySeqLong.getUnorderedKeyToRemove(); 65 while (vKey != null) { 66 //System.out.println(vKey); 67 vTree.remove(vKey); 68 vTree.lazySave(); 69 //checkAllEntries(vTree); 70 vKey = fFactorySeqLong.getUnorderedKeyToRemove(); 71 } 72 Assert.assertTrue(vTree.isEmpty()); 73 } 74 75 protected void checkSize(Map<Long, Long> pTree, int pSize) { 76 Assert.assertEquals(pTree.size(), pSize); 50 77 } 51 78 … … 56 83 vCount++; 57 84 } 58 Assert.assertEquals(pTree.size(), vCount);85 checkSize(pTree, vCount); 59 86 for (Iterator<Long> vIt = fFactorySeqLong.creationOrderIterator(); vIt.hasNext();) { 60 87 Long vKey = vIt.next();
Note: See TracChangeset
for help on using the changeset viewer.