Add @Override annotations to BitmapIndexImpl

This makes it easier to distinguish between implementations of methods
from the interface from helpers internal to org.eclipse.jgit.internal.storage.*.

This was illegal in Java 5 but JGit requires newer Java these days.

Change-Id: I92c65f3407a334acddd32ec9e09ab7d1d39c4dc6
This commit is contained in:
Jonathan Nieder 2015-11-03 18:38:18 -08:00
parent 0e403a18e6
commit 424aa22b56
1 changed files with 16 additions and 0 deletions

View File

@ -85,6 +85,7 @@ PackBitmapIndex getPackBitmapIndex() {
return packIndex; return packIndex;
} }
@Override
public CompressedBitmap getBitmap(AnyObjectId objectId) { public CompressedBitmap getBitmap(AnyObjectId objectId) {
EWAHCompressedBitmap compressed = packIndex.getBitmap(objectId); EWAHCompressedBitmap compressed = packIndex.getBitmap(objectId);
if (compressed == null) if (compressed == null)
@ -103,6 +104,7 @@ public CompressedBitmap toBitmap(PackBitmapIndex i,
return new CompressedBitmap(b); return new CompressedBitmap(b);
} }
@Override
public CompressedBitmapBuilder newBitmapBuilder() { public CompressedBitmapBuilder newBitmapBuilder() {
return new CompressedBitmapBuilder(); return new CompressedBitmapBuilder();
} }
@ -211,6 +213,7 @@ void set(int position) {
private final class CompressedBitmapBuilder implements BitmapBuilder { private final class CompressedBitmapBuilder implements BitmapBuilder {
private ComboBitset bitset = new ComboBitset(); private ComboBitset bitset = new ComboBitset();
@Override
public boolean add(AnyObjectId objectId, int type) { public boolean add(AnyObjectId objectId, int type) {
int position = addObject(objectId, type); int position = addObject(objectId, type);
if (bitset.contains(position)) if (bitset.contains(position))
@ -226,17 +229,20 @@ public boolean add(AnyObjectId objectId, int type) {
return true; return true;
} }
@Override
public boolean contains(AnyObjectId objectId) { public boolean contains(AnyObjectId objectId) {
int position = findPosition(objectId); int position = findPosition(objectId);
return 0 <= position && bitset.contains(position); return 0 <= position && bitset.contains(position);
} }
@Override
public void remove(AnyObjectId objectId) { public void remove(AnyObjectId objectId) {
int position = findPosition(objectId); int position = findPosition(objectId);
if (0 <= position) if (0 <= position)
bitset.remove(position); bitset.remove(position);
} }
@Override
public CompressedBitmapBuilder or(Bitmap other) { public CompressedBitmapBuilder or(Bitmap other) {
if (isSameCompressedBitmap(other)) { if (isSameCompressedBitmap(other)) {
bitset.or(((CompressedBitmap) other).bitmap); bitset.or(((CompressedBitmap) other).bitmap);
@ -249,6 +255,7 @@ public CompressedBitmapBuilder or(Bitmap other) {
return this; return this;
} }
@Override
public CompressedBitmapBuilder andNot(Bitmap other) { public CompressedBitmapBuilder andNot(Bitmap other) {
if (isSameCompressedBitmap(other)) { if (isSameCompressedBitmap(other)) {
bitset.andNot(((CompressedBitmap) other).bitmap); bitset.andNot(((CompressedBitmap) other).bitmap);
@ -261,6 +268,7 @@ public CompressedBitmapBuilder andNot(Bitmap other) {
return this; return this;
} }
@Override
public CompressedBitmapBuilder xor(Bitmap other) { public CompressedBitmapBuilder xor(Bitmap other) {
if (isSameCompressedBitmap(other)) { if (isSameCompressedBitmap(other)) {
bitset.xor(((CompressedBitmap) other).bitmap); bitset.xor(((CompressedBitmap) other).bitmap);
@ -274,18 +282,22 @@ public CompressedBitmapBuilder xor(Bitmap other) {
} }
/** @return the fully built immutable bitmap */ /** @return the fully built immutable bitmap */
@Override
public CompressedBitmap build() { public CompressedBitmap build() {
return new CompressedBitmap(bitset.combine()); return new CompressedBitmap(bitset.combine());
} }
@Override
public Iterator<BitmapObject> iterator() { public Iterator<BitmapObject> iterator() {
return build().iterator(); return build().iterator();
} }
@Override
public int cardinality() { public int cardinality() {
return bitset.combine().cardinality(); return bitset.combine().cardinality();
} }
@Override
public boolean removeAllOrNone(PackBitmapIndex index) { public boolean removeAllOrNone(PackBitmapIndex index) {
if (!packIndex.equals(index)) if (!packIndex.equals(index))
return false; return false;
@ -312,14 +324,17 @@ final class CompressedBitmap implements Bitmap {
this.bitmap = bitmap; this.bitmap = bitmap;
} }
@Override
public CompressedBitmap or(Bitmap other) { public CompressedBitmap or(Bitmap other) {
return new CompressedBitmap(bitmap.or(bitmapOf(other))); return new CompressedBitmap(bitmap.or(bitmapOf(other)));
} }
@Override
public CompressedBitmap andNot(Bitmap other) { public CompressedBitmap andNot(Bitmap other) {
return new CompressedBitmap(bitmap.andNot(bitmapOf(other))); return new CompressedBitmap(bitmap.andNot(bitmapOf(other)));
} }
@Override
public CompressedBitmap xor(Bitmap other) { public CompressedBitmap xor(Bitmap other) {
return new CompressedBitmap(bitmap.xor(bitmapOf(other))); return new CompressedBitmap(bitmap.xor(bitmapOf(other)));
} }
@ -338,6 +353,7 @@ private final IntIterator ofObjectType(int type) {
return packIndex.ofObjectType(bitmap, type).intIterator(); return packIndex.ofObjectType(bitmap, type).intIterator();
} }
@Override
public Iterator<BitmapObject> iterator() { public Iterator<BitmapObject> iterator() {
final IntIterator dynamic = bitmap.andNot(ones(indexObjectCount)) final IntIterator dynamic = bitmap.andNot(ones(indexObjectCount))
.intIterator(); .intIterator();