Class SparseBitSet.UpdateStrategy

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

protected class SparseBitSet.UpdateStrategy extends SparseBitSet.AbstractStrategy
Update the seven statistics that are computed for each set. These are updated by calling statisticsUpdate, which uses this strategy.
  update| 0 1
       0| 0 0
       1| 1 1 
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    Working space for counting the number of non-zero bits in the bit set.
    protected int
    Working space for keeping count of the number of non-zero words in the bit set.
    protected long
    Working space for find the hash value of the bit set.
    protected int
    Working space for find the size and length of the bit set.
    protected int
    Working space for find the size and length of the bit set.
    protected long
    Working space for find the size and length of the bit set.
    protected long
    Working space for find the size and length of the bit set.

    Fields inherited from class com.zaxxer.sparsebits.SparseBitSet.AbstractStrategy

    F_OP_F_EQ_F, F_OP_X_EQ_F, X_OP_F_EQ_F, X_OP_F_EQ_X
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    block(int base, int u3, int v3, long[] a3, long[] b3)
    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.
    private void
    compute(int index, long word)
    This method does the accumulation of the statistics.
    protected void
    finish(int a2Count, int a3Count)
    This is called to finish the processing started by the strategy (if there needs to be anything done at all).
    protected int
    Properties of this strategy.
    protected boolean
    This method initializes the computations by suitably resetting cache fields or working fields.
    protected boolean
    word(int base, int u3, long[] a3, long[] b3, long mask)
    Deal with a scan that include a partial word within a level3 block.

    Methods inherited from class com.zaxxer.sparsebits.SparseBitSet.AbstractStrategy

    isZeroBlock

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • wMin

      protected transient int wMin
      Working space for find the size and length of the bit set. Holds the index of the first non-empty word in the set.
    • wordMin

      protected transient long wordMin
      Working space for find the size and length of the bit set. Holds copy of the first non-empty word in the set.
    • wMax

      protected transient int wMax
      Working space for find the size and length of the bit set. Holds the index of the last non-empty word in the set.
    • wordMax

      protected transient long wordMax
      Working space for find the size and length of the bit set. Holds a copy of the last non-empty word in the set.
    • hash

      protected transient long hash
      Working space for find the hash value of the bit set. Holds the current state of the computation of the hash value. This value is ultimately transferred to the Cache object.
      See Also:
    • count

      protected transient int count
      Working space for keeping count of the number of non-zero words in the bit set. Holds the current state of the computation of the count. This value is ultimately transferred to the Cache object.
      See Also:
    • cardinality

      protected transient int cardinality
      Working space for counting the number of non-zero bits in the bit set. Holds the current state of the computation of the cardinality.This value is ultimately transferred to the Cache object.
      See Also:
  • Constructor Details

    • UpdateStrategy

      protected UpdateStrategy()
  • 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)
      This method initializes the computations by suitably resetting cache fields or working fields.
      Specified by:
      start in class SparseBitSet.AbstractStrategy
      Parameters:
      b - the other SparseBitSet, for checking if needed.
      Returns:
      true -> if the cache should be set to zero
      Since:
      1.6
    • 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
    • finish

      protected void finish(int a2Count, int a3Count)
      Description copied from class: SparseBitSet.AbstractStrategy
      This is called to finish the processing started by the strategy (if there needs to be anything done at all).
      Overrides:
      finish in class SparseBitSet.AbstractStrategy
      Parameters:
      a2Count - possible count of level2 areas in use
      a3Count - possible count of level3 blocks in use
    • compute

      private void compute(int index, long word)
      This method does the accumulation of the statistics. It must be called in sequential order of the words in the set for which the statistics are being accumulated, and only for non-null values of the second parameter. Two of the values (a2Count and a3Count) are not updated here, but are done in the code near where this method is called.
      Parameters:
      index - the word index of the word supplied
      word - the long non-zero word from the set
      Since:
      1.6