Class SparseBitSet.IntersectsStrategy

java.lang.Object
com.zaxxer.sparsebits.SparseBitSet.AbstractStrategy
com.zaxxer.sparsebits.SparseBitSet.IntersectsStrategy
Enclosing class:
SparseBitSet

protected static class SparseBitSet.IntersectsStrategy extends SparseBitSet.AbstractStrategy
Intersect has a true result if any word in the a set has a bit in common with the b set. During the scan of the a set blocks (and areas) that are all zero may be replaced with empty blocks and areas (null references), but the value of the set is not changed (which is why X_OP_F_EQ_F is not selected, since this would cause parts of the a set to be zero-ed out).
 intersect| 0 1
         0| 0 0
         1| 1 1 
  • Field Details

    • result

      protected boolean result
      The boolean result of the intersects scan Strategy is kept here.
  • Constructor Details

    • IntersectsStrategy

      protected IntersectsStrategy()
  • Method Details

    • properties

      protected int properties()
      Description copied from class: SparseBitSet.AbstractStrategy
      Properties of this strategy.
      Specified by:
      properties in class SparseBitSet.AbstractStrategy
      Returns:
      the int containing the bits representing the properties of this strategy
    • start

      protected boolean start(SparseBitSet b)
      Description copied from class: SparseBitSet.AbstractStrategy
      Instances of this class are to be serially reusable. To start a particular use, an instance is (re-)started by calling this method. It is passed the reference to the other bit set (usually to allow a check on whether it is null or not, so as to simplify the implementation of the block() method.
      Specified by:
      start in class SparseBitSet.AbstractStrategy
      Parameters:
      b - the "other" set, for whatever checking is needed.
      Returns:
      true -> if the cache should be set to zero
    • word

      protected boolean word(int base, int u3, long[] a3, long[] b3, long mask)
      Description copied from class: SparseBitSet.AbstractStrategy
      Deal with a scan that include a partial word within a level3 block. All that is required is that the result be stored (if needed) into the given a set block at the correct position, and that the operation only affect those bits selected by 1 bits in the mask.
      Specified by:
      word in class SparseBitSet.AbstractStrategy
      Parameters:
      base - the base index of the block (to be used if needed)
      u3 - the index of the word within block
      a3 - the level3 block from the a set.
      b3 - the (nominal) level3 block from the b set (not null).
      mask - for the (partial) word
      Returns:
      true if the resulting word is zero
    • block

      protected boolean block(int base, int u3, int v3, long[] a3, long[] b3)
      Description copied from class: SparseBitSet.AbstractStrategy
      Deals with a part of a block that consists of whole words, starting with the given first index, and ending with the word before the last index. For the words processed, the return value should indicate whether all those resulting words were zero, or not.
      Specified by:
      block in class SparseBitSet.AbstractStrategy
      Parameters:
      base - the base index of the block (to be used if needed)
      u3 - the index of the first word within block to process
      v3 - the index of the last word, which may be within block
      a3 - the level3 block from the a set.
      b3 - the (nominal) level3 block from the b set (not null).
      Returns:
      true if the words scanned within the level3 block were all zero