// visit will call a node visitor on each node that overlaps the given interval
visit will call a node visitor on each node that overlaps the given interval
// visit will call a node visitor on each node that overlaps the given interval
func (x *intervalNode) visit(iv *Interval, nilNode *intervalNode, nv nodeVisitor) bool {
	if x == nilNode {
		return true
	}
	v := iv.Compare(&x.iv.Ivl)
	switch {
	case v < 0:
		if !x.left.visit(iv, nilNode, nv) {
			return false
		}
	case v > 0:
		maxiv := Interval{x.iv.Ivl.Begin, x.max}
		if maxiv.Compare(iv) == 0 {
			if !x.left.visit(iv, nilNode, nv) || !x.right.visit(iv, nilNode, nv) {
				return false
			}
		}
	default:
		if !x.left.visit(iv, nilNode, nv) || !nv(x) || !x.right.visit(iv, nilNode, nv) {
			return false
		}
	}
	return true
}
func ( x * intervalNode ) visit ( iv * Interval , nilNode * intervalNode , nv nodeVisitor ) bool { if x == nilNode { return true } v := iv . Compare ( & x . iv . Ivl ) switch { case v < 0 : if ! x . left . visit ( iv , nilNode , nv ) { return false } case v > 0 : maxiv := Interval { x . iv . Ivl . Begin , x . max } if maxiv . Compare ( iv ) == 0 { if ! x . left . visit ( iv , nilNode , nv ) || ! x . right . visit ( iv , nilNode , nv ) { return false } } default : if ! x . left . visit ( iv , nilNode , nv ) || ! nv ( x ) || ! x . right . visit ( iv , nilNode , nv ) { return false } } return true }
visit will call a node visitor on each node that overlaps the given interval
visit will call a node visitor on each node that overlaps the given interval