Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void fillPathFields(String a, String b) {
- //Preenchendo todos os caminhos
- try {
- ArrayList<ArrayList<String>> paths = gf.getPossibleRoutes(a, b);
- String aText = "";
- for (int i = 0; i < paths.size(); i++) {
- ArrayList<String> p = paths.get(i);
- aText += "Caminho " + (i + 1) + ":\n";
- for (String p1 : p) {
- if(!p1.equals(b))
- aText += p1 + "\n->";
- else
- aText += p1 +"\n";
- }
- aText += "Total: "+MainInterface.format(gf.getPathWeigth(p))+"\n\n";
- }
- allPathsPane.setText(aText);
- } catch (VertexNotFoundException ex) {
- allPathsPane.setText("Não existem caminhos!");
- }
- try {
- //Preenchendo melhor caminho
- ArrayList<String> bestPath = gf.getSmallerPath(a, b);
- String bText = "";
- for (String s : bestPath) {
- if(s!= b)
- bText += s + "\n->";
- else
- bText += s +"\n";
- }
- bestPathPane.setText(bText);
- } catch (PathlessException ex) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement