package gw.rating.rtm.util uses java.lang.Comparable uses gw.rating.rtm.validation.RangeMatchOpValidator class MatchOpValidationRange { var _max: Comparable as itsMax var _min: Comparable as itsMin var _validator : RangeMatchOpValidator construct(validator: RangeMatchOpValidator, bottom: Comparable, top: Comparable) { _min = bottom _max = top _validator = validator } function overlapsWith(other: MatchOpValidationRange) : boolean { if (this.before(other)) return false if (this.after(other)) return false return true } function before(other: MatchOpValidationRange) : boolean { // Unless this range's max or other's min is null (i.e. not bound)... if (other.itsMin == null || this.itsMax == null) return false //... this range is before other if this range's max is before the other's min else return _validator.doCompare(this.itsMax, other.itsMin) } function after(other: MatchOpValidationRange) : boolean { // Unless other range's max or this range's min is null (i.e. not bound)... if (other.itsMax == null || this.itsMin == null) return false else //... this range is after other if other's max is before this range's min return _validator.doCompare(other.itsMax, this.itsMin) } }