@Test public void testSort() { initLists(); parameters.add("Q5"); parameters.add("RIGHTLEFT"); dialog.sort(parameters); parameters.clear(); parameters.add("Q5"); dialog.printLists(parameters); parameters.clear(); parameters.add("ALL"); parameters.add("VERTICES"); parameters.add("ID"); parameters.add("<"); parameters.add("15"); parameters.add("LESS15"); dialog.filter(parameters, c20, highlights); assertEquals(15, dialog.findVertexList("LESS15").size()); parameters.clear(); parameters.add("LESS15"); parameters.add("ID"); parameters.add("ASC"); dialog.sort(parameters); assertEquals(0, dialog.findVertexList("LESS15").get(0).id); assertEquals(15, dialog.findVertexList("LESS15").size()); parameters.clear(); parameters.add("LESS15"); parameters.add("ID"); parameters.add("DESC"); dialog.sort(parameters); assertEquals(14, dialog.findVertexList("LESS15").get(0).id); assertEquals(15, dialog.findVertexList("LESS15").size()); parameters.clear(); parameters.add("LESS15"); parameters.add("ID"); parameters.add("DESC"); }
public void sort(ArrayList<String> parameters) { String listname = parameters.get(0); if (!existsVertexList(listname)) { errorMsg = "No such list, cannot sort.\n"; return; } var list = findVertexList(listname); switch (parameters.get(1)) { case "LEFTRIGHT": list.sort(new ComparatorLEFTRIGHT()); break; case "RIGHTLEFT": list.sort(new ComparatorRIGHTLEFT()); break; case "TOPDOWN": list.sort(new ComparatorTOPDOWN()); break; case "BOTTOMUP": list.sort(new ComparatorBOTTOMUP()); break; case "ID": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorIDasc()); else list.sort(new ComparatorIDdesc()); break; case "LABEL": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorLabelAsc()); else list.sort(new ComparatorLabelDesc()); break; default: errorMsg = parameters.get(1) + " is not a sort order.\n"; break; } }
Dialog { public void sort(ArrayList<String> parameters) { String listname = parameters.get(0); if (!existsVertexList(listname)) { errorMsg = "No such list, cannot sort.\n"; return; } var list = findVertexList(listname); switch (parameters.get(1)) { case "LEFTRIGHT": list.sort(new ComparatorLEFTRIGHT()); break; case "RIGHTLEFT": list.sort(new ComparatorRIGHTLEFT()); break; case "TOPDOWN": list.sort(new ComparatorTOPDOWN()); break; case "BOTTOMUP": list.sort(new ComparatorBOTTOMUP()); break; case "ID": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorIDasc()); else list.sort(new ComparatorIDdesc()); break; case "LABEL": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorLabelAsc()); else list.sort(new ComparatorLabelDesc()); break; default: errorMsg = parameters.get(1) + " is not a sort order.\n"; break; } } }
Dialog { public void sort(ArrayList<String> parameters) { String listname = parameters.get(0); if (!existsVertexList(listname)) { errorMsg = "No such list, cannot sort.\n"; return; } var list = findVertexList(listname); switch (parameters.get(1)) { case "LEFTRIGHT": list.sort(new ComparatorLEFTRIGHT()); break; case "RIGHTLEFT": list.sort(new ComparatorRIGHTLEFT()); break; case "TOPDOWN": list.sort(new ComparatorTOPDOWN()); break; case "BOTTOMUP": list.sort(new ComparatorBOTTOMUP()); break; case "ID": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorIDasc()); else list.sort(new ComparatorIDdesc()); break; case "LABEL": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorLabelAsc()); else list.sort(new ComparatorLabelDesc()); break; default: errorMsg = parameters.get(1) + " is not a sort order.\n"; break; } } Dialog(List<GralogList<Vertex>> allCollectionVertex, List<GralogList<Edge>> allCollectionEdge);  Dialog(); }
Dialog { public void sort(ArrayList<String> parameters) { String listname = parameters.get(0); if (!existsVertexList(listname)) { errorMsg = "No such list, cannot sort.\n"; return; } var list = findVertexList(listname); switch (parameters.get(1)) { case "LEFTRIGHT": list.sort(new ComparatorLEFTRIGHT()); break; case "RIGHTLEFT": list.sort(new ComparatorRIGHTLEFT()); break; case "TOPDOWN": list.sort(new ComparatorTOPDOWN()); break; case "BOTTOMUP": list.sort(new ComparatorBOTTOMUP()); break; case "ID": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorIDasc()); else list.sort(new ComparatorIDdesc()); break; case "LABEL": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorLabelAsc()); else list.sort(new ComparatorLabelDesc()); break; default: errorMsg = parameters.get(1) + " is not a sort order.\n"; break; } } Dialog(List<GralogList<Vertex>> allCollectionVertex, List<GralogList<Edge>> allCollectionEdge);  Dialog(); @Deprecated Map<String, ArrayList<Vertex>> getVertexListS(); @Deprecated Map<String, ArrayList<Edge>> getEdgeListS(); void printLists(ArrayList<String> parameters); void twoListsOp(ArrayList<String> parameters); void delete(ArrayList<String> parameters); void complement(ArrayList<String> parameters, Structure structure); void sort(ArrayList<String> parameters); void connectClique(ArrayList<String> parameters, Structure structure); void connectTClosure(ArrayList<String> parameters, Structure structure); void connectSelfloop(ArrayList<String> parameters, Structure structure); void connectPath(ArrayList<String> parameters, Structure structure); void connectCycle(ArrayList<String> parameters, Structure structure); void connectBiclique(ArrayList<String> parameters, Structure structure); void connectMatching(ArrayList<String> parameters, Structure structure); void connectFormula(ArrayList<String> parameters, Structure structure); void connect2ListsFormula(ArrayList<String> parameters, Structure structure); boolean existsVertexList(String s); boolean existsEdgeList(String s); GralogList<Vertex> findVertexList(String s); GralogList<Edge> findEdgeList(String s); void filter(ArrayList<String> parameters, Structure structure, Highlights highlights); String getErrorMsg(); void setErrorMsg(String s); boolean addVertex(Vertex v); boolean removeVertex(Vertex v); boolean addEdge(Edge e); boolean removeEdge(Edge e); }
Dialog { public void sort(ArrayList<String> parameters) { String listname = parameters.get(0); if (!existsVertexList(listname)) { errorMsg = "No such list, cannot sort.\n"; return; } var list = findVertexList(listname); switch (parameters.get(1)) { case "LEFTRIGHT": list.sort(new ComparatorLEFTRIGHT()); break; case "RIGHTLEFT": list.sort(new ComparatorRIGHTLEFT()); break; case "TOPDOWN": list.sort(new ComparatorTOPDOWN()); break; case "BOTTOMUP": list.sort(new ComparatorBOTTOMUP()); break; case "ID": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorIDasc()); else list.sort(new ComparatorIDdesc()); break; case "LABEL": if (parameters.get(2).equals("ASC")) list.sort(new ComparatorLabelAsc()); else list.sort(new ComparatorLabelDesc()); break; default: errorMsg = parameters.get(1) + " is not a sort order.\n"; break; } } Dialog(List<GralogList<Vertex>> allCollectionVertex, List<GralogList<Edge>> allCollectionEdge);  Dialog(); @Deprecated Map<String, ArrayList<Vertex>> getVertexListS(); @Deprecated Map<String, ArrayList<Edge>> getEdgeListS(); void printLists(ArrayList<String> parameters); void twoListsOp(ArrayList<String> parameters); void delete(ArrayList<String> parameters); void complement(ArrayList<String> parameters, Structure structure); void sort(ArrayList<String> parameters); void connectClique(ArrayList<String> parameters, Structure structure); void connectTClosure(ArrayList<String> parameters, Structure structure); void connectSelfloop(ArrayList<String> parameters, Structure structure); void connectPath(ArrayList<String> parameters, Structure structure); void connectCycle(ArrayList<String> parameters, Structure structure); void connectBiclique(ArrayList<String> parameters, Structure structure); void connectMatching(ArrayList<String> parameters, Structure structure); void connectFormula(ArrayList<String> parameters, Structure structure); void connect2ListsFormula(ArrayList<String> parameters, Structure structure); boolean existsVertexList(String s); boolean existsEdgeList(String s); GralogList<Vertex> findVertexList(String s); GralogList<Edge> findEdgeList(String s); void filter(ArrayList<String> parameters, Structure structure, Highlights highlights); String getErrorMsg(); void setErrorMsg(String s); boolean addVertex(Vertex v); boolean removeVertex(Vertex v); boolean addEdge(Edge e); boolean removeEdge(Edge e);  }