Package com.zaxxer.sparsebits
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:
SparseBitSet.statisticsUpdate()
-
-
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.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 com.zaxxer.sparsebits.SparseBitSet.AbstractStrategy
isZeroBlock
-
-
-
-
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
-
-
Method Detail
-
properties
protected int properties()
Description copied from class:SparseBitSet.AbstractStrategy
Properties of this strategy.- Specified by:
properties
in classSparseBitSet.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 classSparseBitSet.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 classSparseBitSet.AbstractStrategy
- Parameters:
base
- the base index of the block (to be used if needed)u3
- the index of the word within blocka3
- 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 classSparseBitSet.AbstractStrategy
- Parameters:
base
- the base index of the block (to be used if needed)u3
- the index of the first word within block to processv3
- the index of the last word, which may be within blocka3
- 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 classSparseBitSet.AbstractStrategy
- Parameters:
a2Count
- possible count of level2 areas in usea3Count
- possible count of level3 blocks in use
-
-