Package nl.tue.storage.compressor
Class BitMask
- java.lang.Object
-
- nl.tue.storage.compressor.BitMask
-
- All Implemented Interfaces:
java.lang.Cloneable
public class BitMask extends java.lang.Object implements java.lang.Cloneable
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BitMaskclone()booleanequals(java.lang.Object o)byte[]getBytes()static int[]getIndices(BitMask bitmask)return the indices flagged by this bitmaskintgetNumBits()static intgetNumBytes(int size)returns the number of bytes in a bitmask for a list containing precisely size elements.intgetOnes()inthashCode()The hashcode of BitMask is defined as the hashcode of its bytes.TBooleanIteratoriterator()static BitMaskmakeBitMask(int size, int... indices)Flag the bits at the given indicesstatic BitMaskmakeBitMask(int size, short... indices)Flag the bits at the given indicesstatic BitMaskmakeBitMask(int size, gnu.trove.set.TIntSet indices)Flag the bits at the given indicesstatic BitMaskmakeBitMask(int size, java.util.Collection<java.lang.Integer> indices)Flag the bits at the given indicesvoidset(int index, boolean value)boolean[]toBooleanArray()java.lang.StringtoString()
-
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
The hashcode of BitMask is defined as the hashcode of its bytes.- Overrides:
hashCodein classjava.lang.Object
-
set
public void set(int index, boolean value)
-
getNumBytes
public static int getNumBytes(int size)
returns the number of bytes in a bitmask for a list containing precisely size elements.- Parameters:
size-- Returns:
-
makeBitMask
public static BitMask makeBitMask(int size, int... indices)
Flag the bits at the given indices- Parameters:
indices-
-
makeBitMask
public static BitMask makeBitMask(int size, short... indices)
Flag the bits at the given indices- Parameters:
indices-
-
makeBitMask
public static BitMask makeBitMask(int size, gnu.trove.set.TIntSet indices)
Flag the bits at the given indices- Parameters:
indices-
-
makeBitMask
public static BitMask makeBitMask(int size, java.util.Collection<java.lang.Integer> indices)
Flag the bits at the given indices- Parameters:
indices-
-
getIndices
public static int[] getIndices(BitMask bitmask)
return the indices flagged by this bitmask- Returns:
-
iterator
public TBooleanIterator iterator()
-
getOnes
public int getOnes()
-
getBytes
public byte[] getBytes()
-
getNumBits
public int getNumBits()
-
toBooleanArray
public boolean[] toBooleanArray()
-
clone
public BitMask clone()
- Overrides:
clonein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-