| Modifier and Type | Method and Description |
|---|---|
static SortedMap<Integer,BitSet> |
closure(SortedMap<Integer,BitSet> equivalence)
Computes the closure of a map from integers to bits.
|
static boolean |
contains(BitSet set0,
BitSet set1)
Returns true if all bits set in the second parameter are also set in the
first.
|
static boolean |
contains(BitSet set0,
ImmutableBitSet set1)
Returns true if all bits set in the second parameter are also set in the
first.
|
static BitSet |
of(ImmutableIntList bits)
Creates a BitSet with given bits set.
|
static BitSet |
of(int... bits)
Creates a bitset with given bits set.
|
static BitSet |
of(Integer[] bits)
Creates a BitSet with given bits set.
|
static BitSet |
of(Iterable<? extends Number> bits)
Creates a BitSet with given bits set.
|
static void |
populate(BitSet bitSet,
ImmutableIntList list)
Populates a
BitSet from an
ImmutableIntList. |
static void |
populate(BitSet bitSet,
Iterable<? extends Number> list)
Populates a
BitSet from an iterable, such as a list of integer. |
static int |
previousClearBit(BitSet bitSet,
int fromIndex)
Returns the previous clear bit.
|
static BitSet |
range(int toIndex)
Creates a BitSet with bits between 0 and
toIndex set. |
static BitSet |
range(int fromIndex,
int toIndex)
Creates a bitset with bits from
fromIndex (inclusive) to
specified toIndex (exclusive) set to true. |
static void |
setAll(BitSet bitSet,
Iterable<? extends Number> list)
Sets all bits in a given BitSet corresponding to integers from a list.
|
static int[] |
toArray(BitSet bitSet)
Converts a BitSet to an array.
|
static Iterable<Integer> |
toIter(BitSet bitSet)
Returns an iterable over the bits in a bitmap that are set to '1'.
|
static Iterable<Integer> |
toIter(ImmutableBitSet bitSet) |
static IntList |
toList(BitSet bitSet)
Converts a bitset to a list.
|
static BitSet |
union(BitSet set0,
BitSet... sets)
Returns a BitSet that is the union of the given BitSets.
|
public static boolean contains(BitSet set0, BitSet set1)
set0 - Containing bitmapset1 - Bitmap to be checkedpublic static boolean contains(BitSet set0, ImmutableBitSet set1)
set0 - Containing bitmapset1 - Bitmap to be checkedpublic static Iterable<Integer> toIter(BitSet bitSet)
This allows you to iterate over a bit set using a 'foreach' construct. For instance:
BitSet bitSet;
for (int i : Util.toIter(bitSet)) {
print(i);
}bitSet - Bit setpublic static Iterable<Integer> toIter(ImmutableBitSet bitSet)
public static IntList toList(BitSet bitSet)
The list is mutable, and future changes to the list do not affect the contents of the bit set.
bitSet - Bit setpublic static int[] toArray(BitSet bitSet)
bitSet - Bit setpublic static BitSet of(int... bits)
For example, of(0, 3) returns a bit set with bits {0, 3}
set.
bits - Array of bits to setpublic static BitSet of(Integer[] bits)
For example, of(new Integer[] {0, 3}) returns a bit set
with bits {0, 3} set.
bits - Array of bits to setpublic static BitSet of(Iterable<? extends Number> bits)
For example, of(Arrays.asList(0, 3)) returns a bit set
with bits {0, 3} set.
bits - Collection of bits to setpublic static BitSet of(ImmutableIntList bits)
For example, of(ImmutableIntList.of(0, 3)) returns a bit set
with bits {0, 3} set.
bits - Collection of bits to setpublic static BitSet range(int fromIndex, int toIndex)
fromIndex (inclusive) to
specified toIndex (exclusive) set to true.
For example, range(0, 3) returns a bit set with bits
{0, 1, 2} set.
fromIndex - Index of the first bit to be set.toIndex - Index after the last bit to be set.public static BitSet range(int toIndex)
toIndex set.public static void setAll(BitSet bitSet, Iterable<? extends Number> list)
public static BitSet union(BitSet set0, BitSet... sets)
public static int previousClearBit(BitSet bitSet, int fromIndex)
Has same behavior as BitSet.previousClearBit(int), but that method
does not exist before 1.7.
public static SortedMap<Integer,BitSet> closure(SortedMap<Integer,BitSet> equivalence)
The input must have an entry for each position.
Does not modify the input map or its bit sets.
public static void populate(BitSet bitSet, Iterable<? extends Number> list)
BitSet from an iterable, such as a list of integer.public static void populate(BitSet bitSet, ImmutableIntList list)
BitSet from an
ImmutableIntList.Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.