#ifndef BITARRAY_H #define BITARRAY_H #include "utils/StringBuffer.h" class BitArray final { int length; int bits; int* data; public: BitArray(); BitArray(int length, int bits); BitArray(const BitArray& other); BitArray(BitArray&& other); ~BitArray(); BitArray& operator=(BitArray other); BitArray& set(int index, int value); int get(int index) const; int getLength() const; int getBits() const; int getInternalByteSize() const; int select(int index) const; void resize(int newLength, int newBits); void fill(int value); template void toString(StringBuffer& s) const { s.append("["); for(int i = 0; i < length - 1; i++) { s.append(get(i)); s.append(", "); } if(length > 0) { s.append(get(length - 1)); } s.append("]"); } private: void swap(BitArray& other); }; #endif