Ie overlapping ranges should be allowed?
Ahh, you're right.
it's a little tricky to do that since each Range has its own private min/max
Maybe Range can implement Comparable, and you build the tree using it, like we build PQ? In practice though, I wonder how much more efficient a tree would be vs simply sorting and iterating until a range is bigger than value? We're talking probably very few ranges no?
BTW, I think Range would need to implement Comparable as well as compareTo(long) since a value may not fall into the first (sorted order) range (e.g. range.accept() returns false), but you'll need to continue looking until range.compareTo(long) > 0 (i.e. range.minValue > value).
Also, maybe instead of FRN we should return a RangeFRN which contains the range? That way, someone can extract the min/max values of the range without parsing the label by casting to the range added? Hmm, but then you'll need to make the range impls public, but maybe that's not bad? Instead of Range.newLongRange, someone will just do new LongRange()?
I see you decided not to go with generics? In that case, maybe document that you are expected to pass the same Range type? Although, why not make RangeFacetRequest generic and prevent this pitfall?