Examples of EWAHCompressedBitmap


Examples of com.googlecode.javaewah.EWAHCompressedBitmap

    for (int i = 0; i < (int) numEntries; i++) {
      IO.readFully(fd, scratch, 0, 6);
      int nthObjectId = NB.decodeInt32(scratch, 0);
      int xorOffset = scratch[4];
      int flags = scratch[5];
      EWAHCompressedBitmap bitmap = readBitmap(dataInput);

      if (nthObjectId < 0)
        throw new IOException(MessageFormat.format(
            JGitText.get().invalidId, String.valueOf(nthObjectId)));
      if (xorOffset < 0)
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

    return packIndex;
  }

  private static EWAHCompressedBitmap readBitmap(DataInput dataInput)
      throws IOException {
    EWAHCompressedBitmap bitmap = new EWAHCompressedBitmap();
    bitmap.deserialize(dataInput);
    return bitmap;
  }
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

    };
  }

  @Override
  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)
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

  public PackBitmapIndexBuilder(List<ObjectToPack> byName) {
    super(new ObjectIdOwnerMap<StoredBitmap>());
    byOffset = sortByOffset(byName);

    int sizeInWords = Math.max(byOffset.length / 64, 4);
    commits = new EWAHCompressedBitmap(sizeInWords);
    trees = new EWAHCompressedBitmap(sizeInWords);
    blobs = new EWAHCompressedBitmap(sizeInWords);
    tags = new EWAHCompressedBitmap(sizeInWords);
    for (int i = 0; i < byOffset.length; i++) {
      int type = byOffset[i].getType();
      switch (type) {
      case Constants.OBJ_COMMIT:
        commits.set(i);
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

   */
  public void addBitmap(AnyObjectId objectId, Bitmap bitmap, int flags) {
    if (bitmap instanceof BitmapBuilder)
      bitmap = ((BitmapBuilder) bitmap).build();

    EWAHCompressedBitmap compressed;
    if (bitmap instanceof CompressedBitmap)
      compressed = ((CompressedBitmap) bitmap).getEwahCompressedBitmap();
    else
      throw new IllegalArgumentException(bitmap.getClass().toString());

View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

          public StoredEntry next() {
            if (!hasNext())
              throw new NoSuchElementException();
            StoredBitmap item = byAddOrder.get(index);
            int bestXorOffset = 0;
            EWAHCompressedBitmap bestBitmap = item.getBitmap();

            // Attempt to compress the bitmap with an XOR of the
            // previously written entries.
            for (int i = 1; i <= MAX_XOR_OFFSET_SEARCH; i++) {
              int curr = i + index;
              if (curr >= byAddOrder.size())
                break;

              StoredBitmap other = byAddOrder.get(curr);
              EWAHCompressedBitmap bitmap = other.getBitmap()
                  .xor(item.getBitmap());

              if (bitmap.sizeInBytes()
                  < bestBitmap.sizeInBytes()) {
                bestBitmap = bitmap;
                bestXorOffset = i;
              }
            }
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

    public boolean removeAllOrNone(PackBitmapIndex index) {
      if (!packIndex.equals(index))
        return false;

      EWAHCompressedBitmap curr = bitset.combine()
          .xor(ones(indexObjectCount));

      IntIterator ii = curr.intIterator();
      if (ii.hasNext() && ii.next() < indexObjectCount)
        return false;
      bitset = new ComboBitset(curr);
      return true;
    }
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

  PackBitmapIndex getPackBitmapIndex() {
    return packIndex;
  }

  public CompressedBitmap getBitmap(AnyObjectId objectId) {
    EWAHCompressedBitmap compressed = packIndex.getBitmap(objectId);
    if (compressed == null)
      return null;
    return new CompressedBitmap(compressed);
  }
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

    }
    return false;
  }

  private static final EWAHCompressedBitmap ones(int sizeInBits) {
    EWAHCompressedBitmap mask = new EWAHCompressedBitmap();
    mask.addStreamOfEmptyWords(
        true, sizeInBits / EWAHCompressedBitmap.wordinbits);
    int remaining = sizeInBits % EWAHCompressedBitmap.wordinbits;
    if (remaining > 0)
      mask.add((1L << remaining) - 1, remaining);
    return mask;
  }
View Full Code Here

Examples of com.googlecode.javaewah.EWAHCompressedBitmap

    private BitSet toAdd;

    private BitSet toRemove;

    private ComboBitset() {
      this(new EWAHCompressedBitmap());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.