Class SparseBitSet.UpdateStrategy

    • Field Summary

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

      Constructors 
      Modifier Constructor Description
      protected UpdateStrategy()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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()
      Properties of this strategy.
      protected boolean start​(SparseBitSet b)
      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 java.lang.Object

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

      • 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:
        SparseBitSet.Cache
      • 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:
        SparseBitSet.Cache
      • 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:
        SparseBitSet.Cache
    • Constructor Detail

      • UpdateStrategy

        protected UpdateStrategy()
    • Method Detail

      • 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