import java.util.*;
import java.util.stream.Collectors;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;


public class ScheduleParser {
    public static void main(String[] args) throws Exception {
        final Table<String, String, String> table = HashBasedTable.create();

        final Document doc = Jsoup.connect("http://localhost/index.html").userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                .get();
        final Elements rows = doc.select("table tr");
        for (int r = 0; r < rows.size(); r++) {
            final List<Element> columns = rows.get(r).children().stream().filter(e -> e.tagName().equals("td") && !e.attr("colspan").equals("5")).collect(Collectors.toList());
            for (int c = 0; c < columns.size(); c++)
                table.put(Integer.toString(r) + " ", Integer.toString(c) + " ", columns.get(c).text());
        }

        for (Table.Cell<String, String, String> cell : table.cellSet()) {
            System.out.println(cell.getRowKey() + " " + cell.getColumnKey() + " " + cell.getValue());
        }
    }
}