コード例 #1
0
  private String getConnectedComponent(List<Vertice> vertices, Vertice initial) {
    String result = "";
    List<Vertice> listToDelete = new ArrayList<>();

    int finalTime = initial.getFinalTime();
    for (Vertice v : vertices) {
      if (v.getFinalTime() <= finalTime) {
        result += v.getRotulo() + ",";
        listToDelete.add(v);
      }
    }

    vertices.removeAll(listToDelete);
    return result;
  }
コード例 #2
0
  public void printRoutingVector() {
    List<Vertice> vertices = grafo.getVertices();
    String rotulos = "";
    String fathers = "";
    String time = "";
    String temp = "";

    for (Vertice v : vertices) {
      if (v.getFather() != null) {
        temp = v.getFather().getRotulo();
      } else {
        temp = " ";
      }
      rotulos += v.getRotulo() + "   | ";
      fathers += temp + "   | ";
      time += String.valueOf(v.getInitialTime()) + "/" + String.valueOf(v.getFinalTime()) + " | ";
    }

    System.out.println(rotulos);
    System.out.println(fathers);
    System.out.println(time);
  }