} else if (shape instanceof Line) {
Line line = (Line) shape;
line.setStart(line.getX1() + x * line.getY1(), line.getY1() + y * line.getX1());
line.setEnd(line.getX2() + x * line.getY2(), line.getY2() + y * line.getX2());
} else if (shape instanceof Polygon) {
Polygon polygon = (Polygon) shape;
final int size = polygon.getSize();
for (int i = 0; i < size; i++) {
polygon.setVertex(i, polygon.getX(i) + x * polygon.getY(i), polygon.getY(i) + y * polygon.getX(i));
}
} else {
throw new UnsupportedOperationException();
}
}