/// <exception cref="System.IO.IOException"></exception> internal virtual InMemoryNoteBucket ContractIfTooSmall(AnyObjectId noteOn, ObjectReader or) { if (EstimateSize(noteOn, or) < LeafBucket.MAX_SIZE) { // We are small enough to just contract to a single leaf. InMemoryNoteBucket r = new LeafBucket(prefixLen); for (Sharpen.Iterator <Note> i = Iterator(noteOn, or); i.HasNext();) { r = r.Append(i.Next()); } r.nonNotes = nonNotes; return(r); } return(this); }
internal override InMemoryNoteBucket Append(Note note) { int cell = Cell(note); InMemoryNoteBucket b = (InMemoryNoteBucket)table[cell]; if (b == null) { LeafBucket n = new LeafBucket(prefixLen + 2); table[cell] = n.Append(note); cnt++; } else { InMemoryNoteBucket n = b.Append(note); if (n != b) { table[cell] = n; } } return(this); }