in reply to Getting around nested conditionals

The data structure you're looking for is called an Interval Tree.