
class Connection {

  // lines.csv: "station1","station2","line"
  Station a,b;
  Integer line;
  int time;

  Connection(Station a, Station b, Integer line, int time) {
    this.a = a;
    this.b = b;
    a.conns.add(this);
    b.conns.add(this);
    this.line = line;
    this.time = time;
  }

}

void parseConnections() {
  String strings[] = loadStrings("lines2.csv");
  for (int i = 1; i < strings.length; i++) {
    // lines.csv: "station1","station2","line"
    String words[] = split(strings[i],",");
    int a = int(words[0]);
    int b = int(words[1]);
    Integer line = new Integer(words[2]);
    int t = int(words[3]);
    if (connections.get(line) == null) {
      connections.put(line, new Vector());
    }
    Vector lines = (Vector)connections.get(line);
    lines.add(new Connection((Station)stations.get(new Integer(a)),(Station)stations.get(new Integer(b)),line,t));
  }
}
