Moves an element @param xOld previous x coordinate @param yOld previous y coordinate @param xNew new x coordinate @param yNew new y coordinate @throws Exception Throws an exception, if the element couldn'T be moved
(int xOld, int yOld, int xNew, int yNew)
| 143 | * @throws Exception Throws an exception, if the element couldn'T be moved |
| 144 | */ |
| 145 | public void move(int xOld, int yOld, int xNew, int yNew) throws Exception { |
| 146 | if(root == null){ |
| 147 | throw new Exception("Couldn't move element, quadtree is empty"); |
| 148 | } |
| 149 | T obj = get(xOld, yOld); |
| 150 | remove(xOld, yOld); |
| 151 | insert(obj, xNew, yNew); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Gets the data of all elements |