public function testNonintersectingRange() { $lhsLocation = RTMaxRange($this->range) + 1; $lhsLength = 1; $lhsRange = RTMakeRange($lhsLocation, $lhsLength); $rhsRange = $this->range; $intersectedRange = RTIntersectionRange($lhsRange, $rhsRange); $this->assertSame(0, $intersectedRange->location); $this->assertSame(0, $intersectedRange->length); }
/** Removes from the array each of the objects within a given range. \param $aRange */ public function removeObjectsInRange(RTRange $aRange) { if (RTMaxRange($aRange) >= $this->count()) { throw new RTRangeException("RTMaxRange of " . RTMaxRange($aRange) . " exceeds bounds of " . "0-" . ($this->count() - 1)); } for ($i = $aRange->location; $i < RTMaxRange($aRange); $i++) { $this->removeObjectAtIndex($aRange->location); } }
function RTRangeInRange(RTRange $lhsRange, RTRange $rhsRange) { return $lhsRange->location <= $rhsRange->location && RTMaxRange($lhsRange) >= RTMaxRange($rhsRange); }