private ObjectId write(NonNoteEntry list) throws IOException { LeafBucket b = new LeafBucket(0); b.nonNotes = list; return b.writeTree(inserter); } }
/** * Construct a new empty note map. * * @return an empty note map. */ public static NoteMap newEmptyMap() { NoteMap r = new NoteMap(null /* no reader */); r.root = new LeafBucket(0); return r; }
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 newRoot = root.set(noteOn, noteData, reader); if (newRoot == null) { newRoot = new LeafBucket(0); newRoot.nonNotes = root.nonNotes;
@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 set(AnyObjectId noteOn, AnyObjectId noteData, ObjectReader or) throws IOException { int cell = cell(noteOn); NoteBucket b = table[cell]; if (b == null) { if (noteData == null) return this; LeafBucket n = new LeafBucket(prefixLen + 2); table[cell] = n.set(noteOn, noteData, or); cnt++; return this; } else { NoteBucket n = b.set(noteOn, noteData, or); if (n == null) { table[cell] = null; cnt--; if (cnt == 0) return null; return contractIfTooSmall(noteOn, or); } else if (n != b) { table[cell] = n; } return this; } }
private LeafBucket parseLeafTree() { final LeafBucket leaf = new LeafBucket(prefixLen); final MutableObjectId idBuf = new MutableObjectId(); for (; !eof(); next(1)) { if (parseObjectId(idBuf)) leaf.parseOneEntry(idBuf, getEntryObjectId()); else storeNonNote(); } return leaf; }
private InMemoryNoteBucket parseTree() { for (; !eof(); next(1)) { if (pathLen == pathPadding + OBJECT_ID_STRING_LENGTH && isHex()) return parseLeafTree(); else if (getNameLength() == 2 && isHex() && isTree()) return parseFanoutTree(); else storeNonNote(); } // If we cannot determine the style used, assume its a leaf. return new LeafBucket(prefixLen); }
private ObjectId write(NonNoteEntry list) throws IOException { LeafBucket b = new LeafBucket(0); b.nonNotes = list; return b.writeTree(inserter); } }
private ObjectId write(NonNoteEntry list) throws IOException { LeafBucket b = new LeafBucket(0); b.nonNotes = list; return b.writeTree(inserter); } }
/** * Construct a new empty note map. * * @return an empty note map. */ public static NoteMap newEmptyMap() { NoteMap r = new NoteMap(null /* no reader */); r.root = new LeafBucket(0); return r; }
/** * Construct a new empty note map. * * @return an empty note map. */ public static NoteMap newEmptyMap() { NoteMap r = new NoteMap(null /* no reader */); r.root = new LeafBucket(0); return r; }
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; }
tb = notNullOrEmpty(tb); InMemoryNoteBucket result = new LeafBucket(treeDepth * 2); int bi = 0, oi = 0, ti = 0; while (bi < bb.size() || oi < ob.size() || ti < tb.size()) {
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 LeafBucket parseLeafTree() { final LeafBucket leaf = new LeafBucket(prefixLen); final MutableObjectId idBuf = new MutableObjectId(); for (; !eof(); next(1)) { if (parseObjectId(idBuf)) leaf.parseOneEntry(idBuf, getEntryObjectId()); else storeNonNote(); } return leaf; }
private LeafBucket parseLeafTree() { final LeafBucket leaf = new LeafBucket(prefixLen); final MutableObjectId idBuf = new MutableObjectId(); for (; !eof(); next(1)) { if (parseObjectId(idBuf)) leaf.parseOneEntry(idBuf, getEntryObjectId()); else storeNonNote(); } return leaf; }
private InMemoryNoteBucket parseTree() { for (; !eof(); next(1)) { if (pathLen == pathPadding + OBJECT_ID_STRING_LENGTH && isHex()) return parseLeafTree(); else if (getNameLength() == 2 && isHex() && isTree()) return parseFanoutTree(); else storeNonNote(); } // If we cannot determine the style used, assume its a leaf. return new LeafBucket(prefixLen); }
private InMemoryNoteBucket parseTree() { for (; !eof(); next(1)) { if (pathLen == pathPadding + OBJECT_ID_STRING_LENGTH && isHex()) return parseLeafTree(); else if (getNameLength() == 2 && isHex() && isTree()) return parseFanoutTree(); else storeNonNote(); } // If we cannot determine the style used, assume its a leaf. return new LeafBucket(prefixLen); }