Class BitGroup


  • public class BitGroup
    extends java.lang.Object
    Class used to organize long values into sets of values with overlapping bits. For example, if you had values 1,2,3, 8, 12, you could partition them into two bit groups. The values 1,2,3, would be in one bit group because they all either use the "1" or "2" bit (If there was on "3", then 1 and 2 could be in separate groups). Also the values "8" and "12" are in the same group since they share the "8" bit.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getMask()
      Returns the mask that represents all the bits that are used by the values in this BitGroup.
      java.util.Set<java.lang.Long> getValues()
      Gets the set of values that make up this BitGroup.
      boolean intersects​(BitGroup bitGroup)
      Tests if this bit group has any overlapping bits with the given bit group.
      void merge​(BitGroup bitGroup)
      Merges the given BitGroup into the group.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • intersects

        public boolean intersects​(BitGroup bitGroup)
        Tests if this bit group has any overlapping bits with the given bit group.
        Parameters:
        bitGroup - the BitGroup to test for overlap.
        Returns:
        true if the groups have any bits in common.
      • merge

        public void merge​(BitGroup bitGroup)
        Merges the given BitGroup into the group. All of its values will be added to this group's values and the masks will be or'ed together.
        Parameters:
        bitGroup - the BitGroup to merge into this one.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getMask

        public long getMask()
        Returns the mask that represents all the bits that are used by the values in this BitGroup.
        Returns:
        the mask that represents all the bits that are used by the values in this BitGroup.
      • getValues

        public java.util.Set<java.lang.Long> getValues()
        Gets the set of values that make up this BitGroup.
        Returns:
        the set of values that make up this BitGroup.