Package owl.util

Class BitSetUtil


  • public final class BitSetUtil
    extends Object
    Utility functions to convert from and to bitsets.
    • 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 converted
        stateMap - 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 decoded
        stateMap - 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