Package org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex

Examples of org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex.StoredBitmap


    return new Iterator<Entry>() {
      private Entry entry;

      public boolean hasNext() {
        while (entry == null && it.hasNext()) {
          StoredBitmap sb = it.next();
          if (newPackIndex.findPosition(sb) != -1)
            entry = new Entry(sb, sb.getFlags());
        }
        return entry != null;
      }

      public Entry next() {
View Full Code Here


  public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
    EWAHCompressedBitmap bitmap = newPackIndex.getBitmap(objectId);
    if (bitmap != null || oldPackIndex == null)
      return bitmap;

    StoredBitmap stored = convertedBitmaps.get(objectId);
    if (stored != null)
      return stored.getBitmap();

    StoredBitmap oldBitmap = oldPackIndex.getBitmaps().get(objectId);
    if (oldBitmap == null)
      return null;

    if (newPackIndex.findPosition(objectId) == -1)
      return null;

    inflated.clear();
    for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();)
      inflated.set(prevToNewMapping[i.next()]);
    bitmap = inflated.toEWAHCompressedBitmap();
    convertedBitmaps.add(
        new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags()));
    return bitmap;
  }
View Full Code Here

public class StoredBitmapTest {

  @Test
  public void testGetBitmapWithoutXor() {
    EWAHCompressedBitmap b = bitmapOf(100);
    StoredBitmap sb = newStoredBitmap(bitmapOf(100));
    assertEquals(b, sb.getBitmap());
  }
View Full Code Here

    assertEquals(b, sb.getBitmap());
  }

  @Test
  public void testGetBitmapWithOneXor() {
    StoredBitmap sb = newStoredBitmap(bitmapOf(100), bitmapOf(100, 101));
    assertEquals(bitmapOf(101), sb.getBitmap());
  }
View Full Code Here

    assertEquals(bitmapOf(101), sb.getBitmap());
  }

  @Test
  public void testGetBitmapWithThreeXor() {
    StoredBitmap sb = newStoredBitmap(
        bitmapOf(100),
        bitmapOf(90, 101),
        bitmapOf(100, 101),
        bitmapOf(50));
    assertEquals(bitmapOf(50, 90), sb.getBitmap());
    assertEquals(bitmapOf(50, 90), sb.getBitmap());
  }
View Full Code Here

    assertEquals(bitmapOf(50, 90), sb.getBitmap());
  }

  private static final StoredBitmap newStoredBitmap(
      EWAHCompressedBitmap... bitmaps) {
    StoredBitmap sb = null;
    for (EWAHCompressedBitmap bitmap : bitmaps)
      sb = new StoredBitmap(ObjectId.zeroId(), bitmap, sb, 0);
    return sb;
  }
View Full Code Here

    return new Iterator<Entry>() {
      private Entry entry;

      public boolean hasNext() {
        while (entry == null && it.hasNext()) {
          StoredBitmap sb = it.next();
          if (newPackIndex.findPosition(sb) != -1)
            entry = new Entry(sb, sb.getFlags());
        }
        return entry != null;
      }

      public Entry next() {
View Full Code Here

  public EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
    EWAHCompressedBitmap bitmap = newPackIndex.getBitmap(objectId);
    if (bitmap != null || oldPackIndex == null)
      return bitmap;

    StoredBitmap stored = convertedBitmaps.get(objectId);
    if (stored != null)
      return stored.getBitmap();

    StoredBitmap oldBitmap = oldPackIndex.getBitmaps().get(objectId);
    if (oldBitmap == null)
      return null;

    if (newPackIndex.findPosition(objectId) == -1)
      return null;

    inflated.clear();
    for (IntIterator i = oldBitmap.getBitmap().intIterator(); i.hasNext();)
      inflated.set(prevToNewMapping[i.next()]);
    bitmap = inflated.toEWAHCompressedBitmap();
    convertedBitmaps.add(
        new StoredBitmap(objectId, bitmap, null, oldBitmap.getFlags()));
    return bitmap;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.internal.storage.file.BasePackBitmapIndex.StoredBitmap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.