diff --git a/src/main/java/ee/ut/dendroloj/GraphCanvas.java b/src/main/java/ee/ut/dendroloj/GraphCanvas.java index 6aa3388..f96cc9d 100644 --- a/src/main/java/ee/ut/dendroloj/GraphCanvas.java +++ b/src/main/java/ee/ut/dendroloj/GraphCanvas.java @@ -42,8 +42,6 @@ public void drawVertex(V vertex, String label, Color color) { addVertex(new Vertex<>(vertex, label, color)); } - // TODO: Reorder arguments so x and y are before label? This would group all visual parameters that users are likely to tweak (label and color) at the end. - // public void drawFixedVertex(V vertex, double x, double y) { // if (vertex == null) throw new NullPointerException("Vertex must not be null"); // drawVertex(vertex, vertex.toString(), null); @@ -52,7 +50,7 @@ public void drawVertex(V vertex, String label, Color color) { /** * Draws a vertex with the given label at the given coordinates. */ - public void drawFixedVertex(V vertex, String label, double x, double y) { + public void drawFixedVertex(V vertex, double x, double y, String label) { if (vertex == null) throw new NullPointerException("Vertex must not be null"); addVertex(new Vertex<>(vertex, label, null, x, y)); } @@ -60,11 +58,27 @@ public void drawFixedVertex(V vertex, String label, double x, double y) { /** * Draws a vertex with the given label at the given coordinates. */ - public void drawFixedVertex(V vertex, String label, double x, double y, Color color) { + public void drawFixedVertex(V vertex, double x, double y, String label, Color color) { if (vertex == null) throw new NullPointerException("Vertex must not be null"); addVertex(new Vertex<>(vertex, label, color, x, y)); } + /** + * @deprecated use {@link #drawFixedVertex(V, double, double, String)} instead + */ + @Deprecated + public void drawFixedVertex(V vertex, String label, double x, double y) { + drawFixedVertex(vertex, x, y, label); + } + + /** + * @deprecated use {@link #drawFixedVertex(V, double, double, String, Color)} instead + */ + @Deprecated + public void drawFixedVertex(V vertex, String label, double x, double y, Color color) { + drawFixedVertex(vertex, x, y, label, color); + } + private void addVertex(Vertex vertex) { String id = IdHelper.getNodeId(vertex.vertex); if (drawnVertices.contains(id)) { diff --git a/src/test/java/GraafKatsed.java b/src/test/java/GraafKatsed.java index 70adf64..c6c06fb 100644 --- a/src/test/java/GraafKatsed.java +++ b/src/test/java/GraafKatsed.java @@ -51,7 +51,7 @@ public static void main(String[] args) { GraphCanvas lõuend = new GraphCanvas<>(); for (Tipp tipp : tipud) { - lõuend.drawFixedVertex(tipp, tipp.tähis, tipp.x, tipp.y); + lõuend.drawFixedVertex(tipp, tipp.x, tipp.y, tipp.tähis); for (Kaar kaar : tipp.kaared) { lõuend.drawEdge(tipp, kaar.lõppTipp, String.valueOf(kaar.kaal)); }