func RangeSub(large *mesosproto.Value_Range, small *mesosproto.Value_Range) (*mesosproto.Value_Range, *mesosproto.Value_Range) { subedLeftBegin := large.GetBegin() subedLeftEnd := small.GetBegin() - 1 subedLeftRange := &mesosproto.Value_Range{ Begin: &subedLeftBegin, End: &subedLeftEnd, } if subedLeftEnd < subedLeftBegin { subedLeftRange = nil } subedRightBegin := small.GetEnd() + 1 subedRightEnd := large.GetEnd() subedRightRange := &mesosproto.Value_Range{ Begin: &subedRightBegin, End: &subedRightEnd, } if subedRightBegin > subedRightEnd { subedRightRange = nil } return subedLeftRange, subedRightRange }
func RangeInside(large *mesosproto.Value_Range, small *mesosproto.Value_Range) bool { return large.GetBegin() <= small.GetBegin() && large.GetEnd() >= small.GetEnd() }