public class LongValueBitSet extends net.openhft.chronicle.core.io.AbstractCloseable implements Marshallable, ChronicleBitSet
BitSet is intended to be shared between processes. To minimize locking constraints, it is implemented as a lock-free solution
without support for resizing.closedHere, DISABLE_DISCARD_WARNING, DISABLE_THREAD_SAFETY, STRICT_DISCARD_WARNING, WARN_NSBITS_PER_WORDEMPTYDISCARD| Constructor and Description |
|---|
LongValueBitSet(int maxNumberOfBits) |
LongValueBitSet(int maxNumberOfBits,
Wire w) |
LongValueBitSet(long maxNumberOfBits) |
LongValueBitSet(long maxNumberOfBits,
Wire w) |
| Modifier and Type | Method and Description |
|---|---|
void |
and(ChronicleBitSet set)
Performs a logical AND of this target bit set with the argument bit set.
|
void |
and(LongValueBitSet set) |
void |
andNot(ChronicleBitSet set)
Clears all of the bits in this
ChronicleBitSet whose corresponding bit is set in the specified ChronicleBitSet. |
void |
andNot(LongValueBitSet set) |
int |
cardinality()
Returns the number of bits set to
true in this ChronicleBitSet. |
void |
clear()
Sets all of the bits in this ChronicleBitSet to
false. |
void |
clear(int bitIndex)
Sets the bit specified by the index to
false. |
void |
clear(int fromIndex,
int toIndex)
Sets the bits from the specified
fromIndex (inclusive) to the specified toIndex (exclusive) to false. |
void |
copyFrom(ChronicleBitSet bitSet) |
boolean |
equals(Object obj)
Compares this object against the specified object.
|
void |
flip(int bitIndex)
Sets the bit at the specified index to the complement of its current value.
|
void |
flip(int fromIndex,
int toIndex)
Sets each bit from the specified
fromIndex (inclusive) to the specified toIndex (exclusive) to the complement of its current
value. |
boolean |
get(int bitIndex)
Returns the value of the bit with the specified index.
|
long |
getWord(int wordIndex) |
int |
getWordsInUse() |
int |
hashCode()
Returns the hash code value for this bit set.
|
boolean |
intersects(ChronicleBitSet set)
Returns
true if the specified ChronicleBitSet has any bits set to true that are also set to true in this ChronicleBitSet. |
boolean |
intersects(LongValueBitSet set) |
int |
nextClearBit(int fromIndex)
Returns the index of the first bit that is set to
false that occurs on or after the specified starting index. |
int |
nextSetBit(int fromIndex)
Returns the index of the first bit that is set to
true that occurs on or after the specified starting index. |
int |
nextSetBit(int fromIndex,
int toIndex)
Returns the index of the first bit that is set to
true that occurs on or after the specified starting index. |
void |
or(ChronicleBitSet set) |
void |
or(LongValueBitSet set)
Performs a logical OR of this bit set with the bit set argument.
|
protected void |
performClose() |
int |
previousClearBit(int fromIndex)
Returns the index of the nearest bit that is set to
false that occurs on or before the specified starting index. |
int |
previousSetBit(int fromIndex)
Returns the index of the nearest bit that is set to
true that occurs on or before the specified starting index. |
void |
readMarshallable(@NotNull WireIn wire)
Reads the state of the Marshallable object from the given wire input.
|
void |
set(int bitIndex)
Sets the bit at the specified index to
true. |
void |
set(int bitIndex,
boolean value)
Sets the bit at the specified index to the specified value.
|
void |
set(int fromIndex,
int toIndex)
Sets the bits from the specified
fromIndex (inclusive) to the specified toIndex (exclusive) to true. |
void |
set(int fromIndex,
int toIndex,
boolean value)
Sets the bits from the specified
fromIndex (inclusive) to the specified toIndex (exclusive) to the specified value. |
void |
set(net.openhft.chronicle.core.values.LongValue word,
long newValue) |
void |
set(net.openhft.chronicle.core.values.LongValue word,
long param,
net.openhft.chronicle.wire.LongValueBitSet.LongFunction function) |
void |
setWord(int wordIndex,
long bits) |
int |
size()
Returns the number of bits of space actually in use by this
ChronicleBitSet to represent bit values. |
IntStream |
stream()
Returns a stream of indices for which this
ChronicleBitSet contains a bit in the set state. |
byte[] |
toByteArray()
Returns a new byte array containing all the bits in this bit set.
|
String |
toString()
Returns a string representation of this bit set.
|
static BitSet |
valueOf(byte[] bytes)
Returns a new bit set containing all the bits in the given byte array.
|
void |
writeMarshallable(@NotNull WireOut wire)
Writes the state of the Marshallable object to the given wire output.
|
void |
xor(ChronicleBitSet set)
Performs a logical XOR of this bit set with the bit set argument.
|
void |
xor(LongValueBitSet set) |
assertCloseable, assertCloseablesClosed, clearUsedByThread, close, createdHere, disableCloseableTracing, disableThreadSafetyCheck, disableThreadSafetyCheck, enableCloseableTracing, gcAndWaitForCloseablesToClose, isClosed, isClosing, isInUserThread, referenceId, resetUsedByThread, shouldPerformCloseInBackground, shouldWaitForClosed, singleThreadedCheckDisabled, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfClosed, throwExceptionIfClosedInSetter, unmonitor, waitForCloseablesToClose, waitForClosed, warnAndCloseIfNotClosedclone, finalize, getClass, notify, notifyAll, wait, wait, waitisEmpty, length$equals, $fieldInfoMap, $fieldInfos, $hashCode, $toString, className, copyTo, deepCopy, fromFile, fromFile, fromString, fromString, fromString, getField, getLongField, mergeToMap, reset, setField, setLongField, streamFromFile, streamFromFilebinaryLengthLength, writeValueunexpectedFieldusesSelfDescribingMessagepublic LongValueBitSet(int maxNumberOfBits)
public LongValueBitSet(int maxNumberOfBits,
Wire w)
public LongValueBitSet(long maxNumberOfBits)
public LongValueBitSet(long maxNumberOfBits,
Wire w)
public static BitSet valueOf(byte[] bytes)
public long getWord(int wordIndex)
getWord in interface ChronicleBitSetpublic void setWord(int wordIndex,
long bits)
setWord in interface ChronicleBitSetprotected void performClose()
performClose in class net.openhft.chronicle.core.io.AbstractCloseablepublic int getWordsInUse()
getWordsInUse in interface ChronicleBitSetpublic void set(net.openhft.chronicle.core.values.LongValue word,
long param,
net.openhft.chronicle.wire.LongValueBitSet.LongFunction function)
public void set(net.openhft.chronicle.core.values.LongValue word,
long newValue)
public byte[] toByteArray()
public void flip(int bitIndex)
flip in interface ChronicleBitSetpublic void flip(int fromIndex,
int toIndex)
fromIndex (inclusive) to the specified toIndex (exclusive) to the complement of its current
value.flip in interface ChronicleBitSetpublic void set(int bitIndex)
true.set in interface ChronicleBitSetbitIndex - a bit indexpublic void set(int bitIndex,
boolean value)
set in interface ChronicleBitSetbitIndex - a bit indexvalue - a boolean value to setpublic void set(int fromIndex,
int toIndex)
fromIndex (inclusive) to the specified toIndex (exclusive) to true.set in interface ChronicleBitSetpublic void set(int fromIndex,
int toIndex,
boolean value)
fromIndex (inclusive) to the specified toIndex (exclusive) to the specified value.set in interface ChronicleBitSetfromIndex - index of the first bit to be settoIndex - index after the last bit to be setvalue - value to set the selected bits toIndexOutOfBoundsException - if fromIndex is negative, or toIndex is negative, or fromIndex is larger than toIndexpublic void clear(int bitIndex)
false.clear in interface ChronicleBitSetbitIndex - the index of the bit to be clearedpublic void clear(int fromIndex,
int toIndex)
fromIndex (inclusive) to the specified toIndex (exclusive) to false.clear in interface ChronicleBitSetpublic void clear()
false.clear in interface ChronicleBitSetpublic boolean get(int bitIndex)
true if the bit with the index bitIndex is currently set in
this ChronicleBitSet; otherwise, the result is false.get in interface ChronicleBitSetbitIndex - the bit indexpublic int nextSetBit(int fromIndex)
true that occurs on or after the specified starting index. If no such bit exists then
-1 is returned.nextSetBit in interface ChronicleBitSetpublic int nextSetBit(int fromIndex,
int toIndex)
true that occurs on or after the specified starting index. If no such bit exists then
-1 is returned.nextSetBit in interface ChronicleBitSetfromIndex - the index to start checking from (inclusive)toIndex - (inclusive) returns -1 if a bit is not found before this value-1 if there is no such bitpublic int nextClearBit(int fromIndex)
false that occurs on or after the specified starting index.nextClearBit in interface ChronicleBitSetpublic int previousSetBit(int fromIndex)
true that occurs on or before the specified starting index. If no such bit exists,
or if -1 is given as the starting index, then -1 is returned.public int previousClearBit(int fromIndex)
false that occurs on or before the specified starting index. If no such bit exists,
or if -1 is given as the starting index, then -1 is returned.public boolean intersects(ChronicleBitSet set)
true if the specified ChronicleBitSet has any bits set to true that are also set to true in this ChronicleBitSet.intersects in interface ChronicleBitSetpublic boolean intersects(LongValueBitSet set)
public int cardinality()
true in this ChronicleBitSet.cardinality in interface ChronicleBitSetpublic void and(ChronicleBitSet set)
true if and only if it both initially had the value true and the corresponding bit in the bit set argument also had the value
true.and in interface ChronicleBitSetpublic void and(LongValueBitSet set)
public void or(LongValueBitSet set)
true
if and only if it either already had the value true or the corresponding bit in the bit set argument has the value true.public void or(ChronicleBitSet set)
or in interface ChronicleBitSetpublic void xor(ChronicleBitSet set)
true if and only if one of the following statements holds:
true, and the
corresponding bit in the argument has the value false.
false, and the
corresponding bit in the argument has the value true.
xor in interface ChronicleBitSetpublic void xor(LongValueBitSet set)
public void andNot(ChronicleBitSet set)
ChronicleBitSet whose corresponding bit is set in the specified ChronicleBitSet.andNot in interface ChronicleBitSetpublic void andNot(LongValueBitSet set)
public int hashCode()
ChronicleBitSet.public int size()
ChronicleBitSet to represent bit values. The maximum element in the set is the size
- 1st element.size in interface ChronicleBitSetpublic boolean equals(Object obj)
true if and only if the argument is not null and is a ChronicleBitSet object that has exactly the same set of bits set to true as this bit set. That is, for every nonnegative int index
k,public String toString()
ChronicleBitSet contains a bit in the set state, the decimal
representation of that index is included in the result. Such indices are listed in order from lowest to highest, separated by ", " (a
comma and a space) and surrounded by braces, resulting in the usual mathematical notation for a set of integers.toString in class net.openhft.chronicle.core.io.AbstractCloseablepublic IntStream stream()
ChronicleBitSet contains a bit in the set state. The indices are returned in order, from lowest to
highest. The size of the stream is the number of bits in the set state, equal to the value returned by the cardinality() method.public void writeMarshallable(@NotNull
@NotNull WireOut wire)
MarshallableThe default implementation will write all values even if they are a default value. c.f. readMarshallable
writeMarshallable in interface MarshallablewriteMarshallable in interface WriteMarshallablewire - The wire output destination.public void readMarshallable(@NotNull
@NotNull WireIn wire)
throws net.openhft.chronicle.core.io.IORuntimeException
MarshallableThe default implementation will use a default value for each field not present
readMarshallable in interface MarshallablereadMarshallable in interface ReadMarshallablewire - The wire input source.net.openhft.chronicle.core.io.IORuntimeException - If an IO error occurs during the read operation.public void copyFrom(ChronicleBitSet bitSet)
copyFrom in interface ChronicleBitSetCopyright © 2023. All rights reserved.