*
* @author Christian Femers
*/
- @SuppressWarnings("synthetic-access")
public static final class BitVectorMutator implements LogicType<BitVectorMutator, BitVector>
{
private Bit[] bits;
return new BitVectorMutator(bv.getBits());
}
+ /**
+ * Returns a new mutator of the specified length, <b>with all bits set to <code>null</code></b>. Use with care!
+ */
+ public static BitVectorMutator ofLength(int length)
+ {
+ return new BitVectorMutator(new Bit[length]);
+ }
+
/**
* Returns an empty mutator which has no bits set and will simply copy the values from the first binary operation performed.
- *
*/
public static BitVectorMutator empty()
{
*
* @throws IllegalStateException if the mutator is (still) empty
*/
- public BitVector get()
+ public BitVector toBitVector()
{
if (bits == null)
throw new IllegalStateException("cannot create a BitVector from an empty mutator");
return this;
}
+ public void setBit(int bitIndex, Bit bit)
+ {
+ bits[bitIndex] = bit;
+ }
+
+ public Bit getBit(int bitIndex)
+ {
+ return bits[bitIndex];
+ }
+
+ public int length()
+ {
+ return bits.length;
+ }
+
private void checkCompatibility(BitVector bv)
{
if (bits != null && bits.length != bv.length())