예제 #1
0
 public function test_lists()
 {
     $as = XAppSession::begin();
     $authorService = new AuthorService();
     $authorList = $authorService->lists();
     $as->commit();
     $this->logger->info("Author list number: " . count($authorList));
     $sameAuthorList = DDA::ins()->list_Author_by_status(Constants::USING);
     $this->assertTrue(count($authorList) == count($sameAuthorList));
     $as = null;
 }
예제 #2
0
 public function test_lists()
 {
     $as = XAppSession::begin();
     $bookService = new BookService();
     $bookList = $bookService->lists();
     $as->commit();
     $this->logger->info("Book list number: " . count($bookList));
     $sameBookList = DDA::ins()->list_Book_by_status(Constants::USING);
     $this->assertTrue(count($bookList) == count($sameBookList));
     $as = null;
 }
예제 #3
0
 public function lists()
 {
     $authorList = DDA::ins()->list_author_by_status(Constants::USING);
     $this->logger->info("List all authors " . count($authorList));
     return $authorList;
 }
예제 #4
0
 public function lists()
 {
     $bookList = DDA::ins()->list_book_by_status(Constants::USING);
     $this->logger->info("List all books " . count($bookList));
     return $bookList;
 }
예제 #5
0
        $this->y = $y;
    }
}
class DDA
{
    public static function rasteriza($ini, $fim)
    {
        $points = array();
        $len;
        if (abs($fim->x - $ini->x) >= abs($fim->y - $ini->y)) {
            $len = abs($fim->x - $ini->x);
        } else {
            $len = abs($fim->y - $ini->y);
        }
        $deltax = ($fim->x - $ini->x) / $len;
        $deltay = ($fim->y - $ini->y) / $len;
        $x = $ini->x;
        $y = $ini->y;
        for ($i = 0; $i < $len; $i++) {
            $points[] = new Point(floor($x), floor($y));
            $x += $deltax;
            $y += $deltay;
        }
        $points[] = new Point(floor($x), floor($y));
        return $points;
    }
}
$points = DDA::rasteriza(new Point(-2, 3), new Point(10, 15));
foreach ($points as $point) {
    echo "({$point->x}, {$point->y})<br />";
}