MCPcopy Create free account
hub / github.com/Neop/mudmap2 / move

Method move

src/main/java/mudmap2/backend/prquadtree/Quadtree.java:145–152  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 3

testMoveMethod · 0.95
moveScreenToCursorMethod · 0.45
mouseDraggedMethod · 0.45

Calls 3

getMethod · 0.95
removeMethod · 0.95
insertMethod · 0.95

Tested by 1

testMoveMethod · 0.76