public class BitStrings
extends java.lang.Object
implements org.apache.hadoop.io.Writable
Constructor and Description |
---|
BitStrings()
Construct bitstrings with empty values.
|
BitStrings(long[] bits)
Construct bitstring with given bit values.
|
Modifier and Type | Method and Description |
---|---|
double |
cardinality()
Returns the cardinality of bitstrings using Flajolet-Martin method.
|
boolean |
equals(java.lang.Object o) |
long |
getBit(int i)
Returns i-th sub-bitstring.
|
long[] |
getBits()
Returns current bit values.
|
int |
hashCode() |
boolean |
isEmpty()
Returns whether all bitstrings are empty or not.
|
void |
or(BitStrings other)
Applies bitwise-or operation on itself and the given bitstrings and assigns the result of operation.
|
void |
readFields(java.io.DataInput in)
Read bitstring values from an input stream.
|
void |
setBit(int i,
long bit)
Sets i-th sub-bitstring to the given bit values.
|
void |
setBits(long[] bits)
Sets the value of bitstring to the given bit values.
|
java.lang.String |
toString() |
void |
write(java.io.DataOutput out)
Writes bitstring values to an output stream.
|
public BitStrings()
public BitStrings(long[] bits)
bits
- The initial bit valuespublic void setBits(long[] bits)
bits
- The bit values to be setpublic long[] getBits()
public long getBit(int i)
i
- The index of desired bitstringpublic void setBit(int i, long bit)
i
- The index of bitstring to be updatedbit
- The bit valuespublic void or(BitStrings other)
other
- The bitstrings for bitwise-or operationpublic boolean isEmpty()
public void write(java.io.DataOutput out) throws java.io.IOException
write
in interface org.apache.hadoop.io.Writable
out
- The output stream object to write the valuesjava.io.IOException
public void readFields(java.io.DataInput in) throws java.io.IOException
readFields
in interface org.apache.hadoop.io.Writable
in
- The input stream object to read the valuesjava.io.IOException
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public double cardinality()
public java.lang.String toString()
toString
in class java.lang.Object