A quadtree leaf @param
| 522 | * @param <T> |
| 523 | */ |
| 524 | private class QuadtreeLeaf<T> implements QuadtreeElement<T>{ |
| 525 | |
| 526 | private QuadtreeElement<T> parent = null; |
| 527 | private final T data; |
| 528 | private final int x, y; |
| 529 | |
| 530 | /** |
| 531 | * Constructs a new quadtree leaf |
| 532 | * @param object element data |
| 533 | * @param _x element x coordinate |
| 534 | * @param _y element y coordinate |
| 535 | */ |
| 536 | public QuadtreeLeaf(T data, int x, int y){ |
| 537 | this.data = data; |
| 538 | this.x = x; |
| 539 | this.y = y; |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * Gets the x coordinate |
| 544 | * @return |
| 545 | */ |
| 546 | @Override |
| 547 | public int getX(){ |
| 548 | return x; |
| 549 | } |
| 550 | |
| 551 | /** |
| 552 | * Gets the y coordinate |
| 553 | * @return |
| 554 | */ |
| 555 | @Override |
| 556 | public int getY(){ |
| 557 | return y; |
| 558 | } |
| 559 | |
| 560 | /** |
| 561 | * Gets the element data |
| 562 | * @return |
| 563 | */ |
| 564 | public T getData(){ |
| 565 | return data; |
| 566 | } |
| 567 | |
| 568 | /** |
| 569 | * Removes the element |
| 570 | */ |
| 571 | @Override |
| 572 | public void remove(){ |
| 573 | if(!(parent instanceof QuadtreeNode)){ |
| 574 | throw new Error("wrong parent class in quadtree (this shouldn't occur)"); |
| 575 | } |
| 576 | ((QuadtreeNode<T>) parent).remove(this); |
| 577 | } |
| 578 | |
| 579 | /** |
| 580 | * Removes the element if it wraps object |
| 581 | * @param object object to check for |
nothing calls this directly
no outgoing calls
no test coverage detected