Look into doing alot of the work in this class using TreeSets and Guava Range classes to help with the logic of sorting and merging the query ranges.