public function test_index_data_with_points() { $set = new PointSet(); $set->attach($p11 = new Point(1, 1), $v11 = 'v11'); static::assertTrue($set->contains($p11)); static::assertEquals($set[$p11], $v11); }
/** * @return PointSet */ public function produce() { $result = new PointSet(); foreach ($this->lowerLeft->forXTimes($this->width) as $x) { foreach ($this->lowerLeft->forYTimes($this->height) as $y) { $point = new Point($x, $y); $value = $this->getValue($point); $result->attach($point, $value); } } return $result; }
/** * @return PointSet */ public function produce() { $result = new PointSet(); foreach ($this->lowerLeft->forXUpTo($this->upperRight) as $x) { foreach ($this->lowerLeft->forYUpTo($this->upperRight) as $y) { $point = new Point($x, $y); $value = $this->getValue($point); $result->attach($point, $value); } } return $result; }
/** * @param PointSet $result * @param Point $point */ private function addPoint(PointSet $result, Point $point) { $value = $this->getValue($point); $result->attach($point, $value); }