@Test public void testMovePoint() throws Exception { class Util { public SimpleVector getPointV1(int i) { return new SimpleVector(Math.pow(i*3,5)%29, Math.pow(i*5,7)%11, Math.pow(i*7,3)%13); } public SimpleVector getPointV2(int i) { return new SimpleVector(Math.pow(i*7,5)%19, Math.pow(i*5,7)%37, Math.pow(i*7,3)%67); } } int[] ids = new int[50]; int i = 0; for(int t : ids) { ids[i] = data.addPoint(new Util().getPointV1(i)); i++; } int[] move = new int[]{20,40,21,3,10,33,21,5,23,9,19}; for (int t : move) { data.movePoint(ids[t], new Util().getPointV2(t)); } for (int t: ids) { boolean contains = false; for (int j : move) { if (j == t) { contains = true; } } assert (contains ? data.getPoint(ids[t]).x == new Util().getPointV2(t).x : data.getPoint(ids[t]).x == new Util().getPointV1(t).x); } for (int aMove : move) { data.undoA(); } for (int t: ids) { assert data.getPoint(ids[t]).x == new Util().getPointV1(t).x; } }
@Override public final boolean movePoint(int pointId, SimpleVector pos) { synchronized (VitcoSettings.SYNC) { boolean result = false; if (isValid(pointId)) { if (dataContainer.activeFrame == -1) { historyManagerA.applyIntent(new MovePointIntent(pointId, pos, false)); } else { historyManagerA.applyIntent(new PlaceFramePointIntent(pointId, pos, dataContainer.activeFrame, false)); } result = true; } return result; } }
AnimationData extends GeneralData implements AnimationDataInterface { @Override public final boolean movePoint(int pointId, SimpleVector pos) { synchronized (VitcoSettings.SYNC) { boolean result = false; if (isValid(pointId)) { if (dataContainer.activeFrame == -1) { historyManagerA.applyIntent(new MovePointIntent(pointId, pos, false)); } else { historyManagerA.applyIntent(new PlaceFramePointIntent(pointId, pos, dataContainer.activeFrame, false)); } result = true; } return result; } } }
AnimationData extends GeneralData implements AnimationDataInterface { @Override public final boolean movePoint(int pointId, SimpleVector pos) { synchronized (VitcoSettings.SYNC) { boolean result = false; if (isValid(pointId)) { if (dataContainer.activeFrame == -1) { historyManagerA.applyIntent(new MovePointIntent(pointId, pos, false)); } else { historyManagerA.applyIntent(new PlaceFramePointIntent(pointId, pos, dataContainer.activeFrame, false)); } result = true; } return result; } } protected  AnimationData(); }
AnimationData extends GeneralData implements AnimationDataInterface { @Override public final boolean movePoint(int pointId, SimpleVector pos) { synchronized (VitcoSettings.SYNC) { boolean result = false; if (isValid(pointId)) { if (dataContainer.activeFrame == -1) { historyManagerA.applyIntent(new MovePointIntent(pointId, pos, false)); } else { historyManagerA.applyIntent(new PlaceFramePointIntent(pointId, pos, dataContainer.activeFrame, false)); } result = true; } return result; } } protected  AnimationData(); @Override final boolean isValid(int pointId); @Override final int addPoint(SimpleVector position); @Override final boolean removePoint(int pointId); @Override final boolean movePoint(int pointId, SimpleVector pos); @Override final boolean areConnected(int id1, int id2); @Override final boolean connect(int id1, int id2); @Override final boolean clearA(); @Override final boolean disconnect(int id1, int id2); @Override final ExtendedVector getPoint(int pointId); @Override final ExtendedVector[] getPoints(); @Override final ExtendedVector[][] getLines(); @Override final void undoA(); @Override final void redoA(); @Override final boolean canUndoA(); @Override final boolean canRedoA(); @Override final boolean selectFrame(int frameId); @Override final int getSelectedFrame(); @Override final int createFrame(String frameName); @Override final boolean deleteFrame(int frameId); @Override final boolean renameFrame(int frameId, String newName); @Override final Integer[] getFrames(); @Override final boolean resetFrame(int frameId); @Override final String getFrameName(int frameId); }
AnimationData extends GeneralData implements AnimationDataInterface { @Override public final boolean movePoint(int pointId, SimpleVector pos) { synchronized (VitcoSettings.SYNC) { boolean result = false; if (isValid(pointId)) { if (dataContainer.activeFrame == -1) { historyManagerA.applyIntent(new MovePointIntent(pointId, pos, false)); } else { historyManagerA.applyIntent(new PlaceFramePointIntent(pointId, pos, dataContainer.activeFrame, false)); } result = true; } return result; } } protected  AnimationData(); @Override final boolean isValid(int pointId); @Override final int addPoint(SimpleVector position); @Override final boolean removePoint(int pointId); @Override final boolean movePoint(int pointId, SimpleVector pos); @Override final boolean areConnected(int id1, int id2); @Override final boolean connect(int id1, int id2); @Override final boolean clearA(); @Override final boolean disconnect(int id1, int id2); @Override final ExtendedVector getPoint(int pointId); @Override final ExtendedVector[] getPoints(); @Override final ExtendedVector[][] getLines(); @Override final void undoA(); @Override final void redoA(); @Override final boolean canUndoA(); @Override final boolean canRedoA(); @Override final boolean selectFrame(int frameId); @Override final int getSelectedFrame(); @Override final int createFrame(String frameName); @Override final boolean deleteFrame(int frameId); @Override final boolean renameFrame(int frameId, String newName); @Override final Integer[] getFrames(); @Override final boolean resetFrame(int frameId); @Override final String getFrameName(int frameId);  }