Class SparseBitSet.AndStrategy
java.lang.Object
com.zaxxer.sparsebits.SparseBitSet.AbstractStrategy
com.zaxxer.sparsebits.SparseBitSet.AndStrategy
- Enclosing class:
SparseBitSet
And of two sets. Where the a set is zero, it remains zero (i.e.,
without entries or with zero words). Similarly, where the b set is
zero, the a becomes zero (i.e., without entries).
If level1 of the a set is longer than level1 of the bit set b, then the unmatched virtual "entries" of the b set (beyond the actual length of b) corresponding to these are all false, hence the result of the "and" operation will be to make all these entries in this set to become false--hence just remove them, and then scan only those entries that could match entries in the bit setb. This clearing of the remainder of the a set is accomplished by selecting both F_OP_X_EQ_F and X_OP_F_EQ_F.
and| 0 1 0| 0 0 1| 0 1
- Since:
- 1.6
- Version:
- 1.0, 2009-03-17
-
Field Summary
Fields inherited from class 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanblock(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 intProperties of this strategy.protected booleanInstances of this class are to be serially reusable.protected booleanword(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 SparseBitSet.AbstractStrategy
finish, isZeroBlock
-
Constructor Details
-
AndStrategy
protected AndStrategy()
-
-
Method Details
-
properties
protected int properties()Description copied from class:SparseBitSet.AbstractStrategyProperties of this strategy.- Specified by:
propertiesin classSparseBitSet.AbstractStrategy- Returns:
- the int containing the bits representing the properties of this strategy
-
start
Description copied from class:SparseBitSet.AbstractStrategyInstances 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:
startin classSparseBitSet.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.AbstractStrategyDeal 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:
wordin 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.AbstractStrategyDeals 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:
blockin 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
-