Package owl.util
Class BitSetUtil
- java.lang.Object
-
- owl.util.BitSetUtil
-
public final class BitSetUtil extends Object
Utility functions to convert from and to bitsets.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <S> BitSetall(com.google.common.collect.BiMap<S,Integer> stateMap)returns Bitset where bits for all elements of the set are set.static BitSetfromInt(int i)Converts an int into a BitSet.static <S> BitSetfromSet(Set<S> set, com.google.common.collect.BiMap<S,Integer> stateMap)Converts a set into a bitset.static <S> BitSetfromSet(Set<S> set, Function<S,Integer> stateMap, int totalSize)static BitSetintersection(BitSet a, BitSet b)static inttoInt(BitSet bs)Converts a BitSet into an Int.static <S> Set<S>toSet(BitSet bs, Function<Integer,S> stateMap)Converts a BitSet into a set.static BitSetunion(BitSet a, BitSet b)static BitSetwithout(BitSet a, BitSet b)
-
-
-
Method Detail
-
all
public static <S> BitSet all(com.google.common.collect.BiMap<S,Integer> stateMap)
returns Bitset where bits for all elements of the set are set.
-
fromSet
public static <S> BitSet fromSet(Set<S> set, com.google.common.collect.BiMap<S,Integer> stateMap)
Converts a set into a bitset.- Parameters:
set- set to be convertedstateMap- mapping from elements to bits- Returns:
- corresponding BitSet
-
toSet
public static <S> Set<S> toSet(BitSet bs, Function<Integer,S> stateMap)
Converts a BitSet into a set.- Parameters:
bs- bitset to be decodedstateMap- mapping from bits to elements- Returns:
- resulting set
-
toInt
public static int toInt(BitSet bs)
Converts a BitSet into an Int.- Parameters:
bs- bitset to be encoded (should be small enough to fit into int)
-
fromInt
public static BitSet fromInt(int i)
Converts an int into a BitSet.- Parameters:
i- int to be decoded into bitset
-
-