Search in sources :

Example 1 with SparseFixedBitSet

use of org.apache.lucene.util.SparseFixedBitSet in project lucene-solr by apache.

the class UnicodeProps method createBits.

private static Bits createBits(final int... codepoints) {
    final int len = codepoints[codepoints.length - 1] + 1;
    final SparseFixedBitSet bitset = new SparseFixedBitSet(len);
    for (int i : codepoints) bitset.set(i);
    return new Bits() {

        @Override
        public boolean get(int index) {
            return index < len && bitset.get(index);
        }

        @Override
        public int length() {
            return 0x10FFFF + 1;
        }
    };
}
Also used : SparseFixedBitSet(org.apache.lucene.util.SparseFixedBitSet) Bits(org.apache.lucene.util.Bits)

Aggregations

Bits (org.apache.lucene.util.Bits)1 SparseFixedBitSet (org.apache.lucene.util.SparseFixedBitSet)1