private static InMemoryNoteBucket addIfNotNull(InMemoryNoteBucket result, Note note) { if (note != null) return result.append(note); else return result; }
InMemoryNoteBucket contractIfTooSmall(AnyObjectId noteOn, ObjectReader or) throws IOException { if (estimateSize(noteOn, or) < LeafBucket.MAX_SIZE) { // We are small enough to just contract to a single leaf. InMemoryNoteBucket r = new LeafBucket(prefixLen); for (Iterator<Note> i = iterator(noteOn, or); i.hasNext();) r = r.append(i.next()); r.nonNotes = nonNotes; return r; } return this; }
@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; }
private static InMemoryNoteBucket addIfNotNull(InMemoryNoteBucket result, Note note) { if (note != null) return result.append(note); else return result; }
private static InMemoryNoteBucket addIfNotNull(InMemoryNoteBucket result, Note note) { if (note != null) return result.append(note); else return result; }
InMemoryNoteBucket contractIfTooSmall(AnyObjectId noteOn, ObjectReader or) throws IOException { if (estimateSize(noteOn, or) < LeafBucket.MAX_SIZE) { // We are small enough to just contract to a single leaf. InMemoryNoteBucket r = new LeafBucket(prefixLen); for (Iterator<Note> i = iterator(noteOn, or); i.hasNext();) r = r.append(i.next()); r.nonNotes = nonNotes; return r; } return this; }
InMemoryNoteBucket contractIfTooSmall(AnyObjectId noteOn, ObjectReader or) throws IOException { if (estimateSize(noteOn, or) < LeafBucket.MAX_SIZE) { // We are small enough to just contract to a single leaf. InMemoryNoteBucket r = new LeafBucket(prefixLen); for (Iterator<Note> i = iterator(noteOn, or); i.hasNext();) r = r.append(i.next()); r.nonNotes = nonNotes; return r; } return this; }
@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; }
@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; }