Example usage for org.eclipse.jgit.internal.storage.pack PackExt getBit

List of usage examples for org.eclipse.jgit.internal.storage.pack PackExt getBit

Introduction

In this page you can find the example usage for org.eclipse.jgit.internal.storage.pack PackExt getBit.

Prototype

public int getBit() 

Source Link

Document

Get the bit mask of the extension e.g 1 << getPosition() .

Usage

From source file:com.benhumphreys.jgitcassandra.store.DescMapper.java

License:Apache License

/**
 * Given a pack description, return a bit field representing the PackExt's
 * present./* ww  w  . j av a  2  s.com*/
        
 * The actual mapping from PackExt to bit position is provided by the
 * PackExt class.
 *
 * @param desc  the pack description to query for pack extensions
 * @return  an integer with bits set for each PackExt present in the pack
 *          description
 */
public static int getExtBits(DfsPackDescription desc) {
    int bits = 0;
    for (PackExt ext : PackExt.values()) {
        if (desc.hasFileExt(ext)) {
            bits |= ext.getBit();
        }
    }
    return bits;
}

From source file:com.benhumphreys.jgitcassandra.store.DescMapper.java

License:Apache License

/**
 * Calls addFileExt on the pack description for each PackExt indicated by
 * the bit field "bits"//w w  w.j  a va 2s . c  om
 *
 * The actual mapping from PackExt to bit position is provided by the
 * PackExt class.
 *
 * @param desc  the pack description to mutate
 * @param bits  the bit field to read from
 */
public static void setExtsFromBits(DfsPackDescription desc, int bits) {
    for (PackExt ext : PackExt.values()) {
        if ((ext.getBit() & bits) != 0) {
            desc.addFileExt(ext);
        }
    }
}