I am using BitSet to represent possible hours where lectures are filled in, the case is that when you put to false the corner bits, they are simplified, this means that they are not anymore in the BitSet. How can I ask BitSet to not simplify?
To make my explanation clearer this is the code:
for(Map.Entry<GrupAssig, BitSet> entry : bitsetPerGrup.entrySet()){
BitSet bitset = entry.getValue();
//n franges per dia
int numFranges = UnitatDocent.getNumFranges();
int indexDia = this.dia.id() * numFranges;
bitset.clear(indexDia, indexDia+numFranges);
}
Imagine that the bitset has 60 bits by default, and numFranges=12 and this.dia.id()=4. This would make the last twelve bits set to 0. The result I get is:
111111111111111111111111111111111111111111111111
But if this.dia.id()=3 I get:
11111111111111111111111111111111111100000000000011111111111
And you can print the BitSet this way:
public static void printBitset(BitSet b) {
StringBuilder s = new StringBuilder();
for( int i = 0; i < b.length(); i++ )
{
s.append( b.get( i ) == true ? 1 : 0 );
}
System.out.println( s );
}
Which demonstrates what I am saying.
Thank you.