private final IntIterator ofObjectType(int type) {
return packIndex.ofObjectType(bitmap, type).intIterator();
}
public Iterator<BitmapObject> iterator() {
final IntIterator dynamic = bitmap.andNot(ones(indexObjectCount))
.intIterator();
final IntIterator commits = ofObjectType(Constants.OBJ_COMMIT);
final IntIterator trees = ofObjectType(Constants.OBJ_TREE);
final IntIterator blobs = ofObjectType(Constants.OBJ_BLOB);
final IntIterator tags = ofObjectType(Constants.OBJ_TAG);
return new Iterator<BitmapObject>() {
private final BitmapObjectImpl out = new BitmapObjectImpl();
private int type;
private IntIterator cached = dynamic;
public boolean hasNext() {
if (!cached.hasNext()) {
if (commits.hasNext()) {
type = Constants.OBJ_COMMIT;
cached = commits;
} else if (trees.hasNext()) {
type = Constants.OBJ_TREE;
cached = trees;
} else if (blobs.hasNext()) {
type = Constants.OBJ_BLOB;
cached = blobs;
} else if (tags.hasNext()) {
type = Constants.OBJ_TAG;
cached = tags;
} else {
return false;
}