// Path: src/main/java/com/tomgibara/bits/Bits.java
// static void checkBitsLength(int length) {
// 	if (length < 0) throw new IllegalArgumentException("negative length");
// 	if (length > 64) throw new IllegalArgumentException("length exceeds 64");
// }


import static com.tomgibara.bits.Bits.checkBitsLength;
	}

	@Override
	public BitStore immutableCopy() {
		return new CharsBitStore(chars.toString(), false);
	}

	@Override
	public BitStore immutableView() {
		return new CharsBitStore(chars, false);
	}

	@Override
	public int size() {
		return chars.length();
	}

	@Override
	public boolean getBit(int index) {
		char c = chars.charAt( adjIndex(index) );
		switch (c) {
		case '0' : return false;
		case '1' : return true;
		default : throw new IllegalStateException("non-binary numeral ' + c + ' at index " + index);
		}
	}

	@Override
	public long getBits(int position, int length) {
		if (position < 0L) throw new IllegalArgumentException("negative position");
// Path: src/main/java/com/tomgibara/bits/Bits.java
// static void checkBitsLength(int length) {
// 	if (length < 0) throw new IllegalArgumentException("negative length");
// 	if (length > 64) throw new IllegalArgumentException("length exceeds 64");
// }


// Path: src/main/java/com/tomgibara/bits/CharsBitStore.java
import static com.tomgibara.bits.Bits.checkBitsLength;

	}

	@Override
	public BitStore immutableCopy() {
		return new CharsBitStore(chars.toString(), false);
	}

	@Override
	public BitStore immutableView() {
		return new CharsBitStore(chars, false);
	}

	@Override
	public int size() {
		return chars.length();
	}

	@Override
	public boolean getBit(int index) {
		char c = chars.charAt( adjIndex(index) );
		switch (c) {
		case '0' : return false;
		case '1' : return true;
		default : throw new IllegalStateException("non-binary numeral ' + c + ' at index " + index);
		}
	}

	@Override
	public long getBits(int position, int length) {
		if (position < 0L) throw new IllegalArgumentException("negative position");
		checkBitsLength(length);