Class BitFlags
java.lang.Object
com.biglybt.core.peermanager.piecepicker.util.BitFlags
- All Implemented Interfaces:
Cloneable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExperimental.void
clear()
clone()
boolean
int
hashCode()
void
set
(int i) for setting a flag that is not known to be the first or last, or notvoid
setAll()
void
setEnd
(int i) this is for setting a flag that is already known to be the last true flagvoid
setOnly
(int i) clears the array then sets the given flagvoid
setStart
(int i) for setting a flag that is already known to be the first true flagint
size()
You can read flags.length instead (but please don't modify it)void
unset
(int i) for setting a flag that is not known to be the first or last, or not
-
Field Details
-
start
public int startIndex of first set bit -
end
public int endIndex of last set bit -
nbSet
public int nbSethow many bits are set -
flags
public final boolean[] flagsThe array of bit flags
-
-
Constructor Details
-
BitFlags
public BitFlags(int count) -
BitFlags
public BitFlags(boolean[] _flags) -
BitFlags
clone constructor
-
-
Method Details
-
clone
-
hashCode
public int hashCode() -
equals
-
size
public int size()You can read flags.length instead (but please don't modify it)- Returns:
- the number of elements in this array
-
clear
public void clear() -
setStart
public void setStart(int i) for setting a flag that is already known to be the first true flag -
set
public void set(int i) for setting a flag that is not known to be the first or last, or not -
unset
public void unset(int i) for setting a flag that is not known to be the first or last, or not -
setEnd
public void setEnd(int i) this is for setting a flag that is already known to be the last true flag -
setOnly
public void setOnly(int i) clears the array then sets the given flag -
setAll
public void setAll() -
and
Experimental. Returns a new BitFlags with flags set as the logical AND of both BitFlags. The length of both must be the same.- Parameters:
other
- BitFlags to be ANDed with this BitFlags. Must not be null.- Returns:
- new BitFlags representing the logical AND of the two
-