package org.btcollider.cnc.dto;

import java.util.BitSet;

import org.btcollider.cnc.CnC;

public class KeyRange {
	private BitSet start;
	private BitSet end;

	public KeyRange(BitSet start, BitSet end) {
		assert start.length() <= CnC.MAX_BITS && end.length() <= CnC.MAX_BITS;

		this.start = start;
		this.end = end;
	}

	public BitSet getStart() {
		return start;
	}

	public BitSet getEnd() {
		return end;
	}

	public Long getTotal() {
		// asserted that <= MAX_BITS, first long contains all significant bits
		Long total = getStart().toLongArray()[0] - getEnd().toLongArray()[0];

		return total;
	}
}
