|
|
|
@ -20,6 +20,7 @@ import java.util.BitSet;
|
|
|
|
|
import org.reactivestreams.Publisher;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Vector of bits that grows as needed.
|
|
|
|
|
*
|
|
|
|
|
* @author Nikita Koksharov
|
|
|
|
|
*
|
|
|
|
@ -30,36 +31,141 @@ public interface RBitSetReactive extends RExpirableReactive {
|
|
|
|
|
|
|
|
|
|
Publisher<byte[]> toByteArray();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns "logical size" = index of highest set bit plus one.
|
|
|
|
|
* Returns zero if there are no any set bit.
|
|
|
|
|
*
|
|
|
|
|
* @return "logical size" = index of highest set bit plus one
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Long> length();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set all bits to <code>value</code> from <code>fromIndex</code> (inclusive) to <code>toIndex</code> (exclusive)
|
|
|
|
|
*
|
|
|
|
|
* @param fromIndex inclusive
|
|
|
|
|
* @param toIndex exclusive
|
|
|
|
|
* @param value true = 1, false = 0
|
|
|
|
|
* @return void
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> set(long fromIndex, long toIndex, boolean value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set all bits to zero from <code>fromIndex</code> (inclusive) to <code>toIndex</code> (exclusive)
|
|
|
|
|
*
|
|
|
|
|
* @param fromIndex inclusive
|
|
|
|
|
* @param toIndex exclusive
|
|
|
|
|
* @return void
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> clear(long fromIndex, long toIndex);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Copy bits state of source BitSet object to this object
|
|
|
|
|
*
|
|
|
|
|
* @param bs - BitSet source
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> set(BitSet bs);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Executes NOT operation over all bits
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> not();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set all bits to one from <code>fromIndex</code> (inclusive) to <code>toIndex</code> (exclusive)
|
|
|
|
|
*
|
|
|
|
|
* @param fromIndex inclusive
|
|
|
|
|
* @param toIndex exclusive
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> set(long fromIndex, long toIndex);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns number of set bits.
|
|
|
|
|
*
|
|
|
|
|
* @return number of set bits.
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Long> size();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns <code>true</code> if bit set to one and <code>false</code> overwise.
|
|
|
|
|
*
|
|
|
|
|
* @param bitIndex - index of bit
|
|
|
|
|
* @return <code>true</code> if bit set to one and <code>false</code> overwise.
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Boolean> get(long bitIndex);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set bit to one at specified bitIndex
|
|
|
|
|
*
|
|
|
|
|
* @param bitIndex - index of bit
|
|
|
|
|
* @return <code>true</code> - if previous value was true,
|
|
|
|
|
* <code>false</code> - if previous value was false
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Boolean> set(long bitIndex);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set bit to <code>value</code> at specified <code>bitIndex</code>
|
|
|
|
|
*
|
|
|
|
|
* @param bitIndex - index of bit
|
|
|
|
|
* @param value true = 1, false = 0
|
|
|
|
|
* @return <code>true</code> - if previous value was true,
|
|
|
|
|
* <code>false</code> - if previous value was false
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Boolean> set(long bitIndex, boolean value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the number of bits set to one.
|
|
|
|
|
*
|
|
|
|
|
* @return number of bits
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Long> cardinality();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set bit to zero at specified <code>bitIndex</code>
|
|
|
|
|
*
|
|
|
|
|
* @param bitIndex - index of bit
|
|
|
|
|
* @return <code>true</code> - if previous value was true,
|
|
|
|
|
* <code>false</code> - if previous value was false
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Boolean> clear(long bitIndex);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set all bits to zero
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> clear();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Executes OR operation over this object and specified bitsets.
|
|
|
|
|
* Stores result into this object.
|
|
|
|
|
*
|
|
|
|
|
* @param bitSetNames - name of stored bitsets
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> or(String... bitSetNames);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Executes AND operation over this object and specified bitsets.
|
|
|
|
|
* Stores result into this object.
|
|
|
|
|
*
|
|
|
|
|
* @param bitSetNames - name of stored bitsets
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> and(String... bitSetNames);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Executes XOR operation over this object and specified bitsets.
|
|
|
|
|
* Stores result into this object.
|
|
|
|
|
*
|
|
|
|
|
* @param bitSetNames - name of stored bitsets
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
Publisher<Void> xor(String... bitSetNames);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|