class H2ScoreDistributionReader implements ScoreDistributionReader {

  @Override
  public Map<Integer, ScoreDistribution> readAll() throws PhenolException {
    // Get all term counts.
    final List<Integer> termCounts = new ArrayList<>();
    try (final PreparedStatement stmt =
            conn.prepareStatement(String.format(H2_SELECT_TERM_COUNTS, tableName));
        final ResultSet rs = stmt.executeQuery()) {
      while (rs.next()) {
        termCounts.add(rs.getInt(1));
      }
    } catch (SQLException e) {
      throw new PhenolException("Problem querying the database for term counts", e);
    }

    // Query for all term counts.
    final Map<Integer, ScoreDistribution> result = new HashMap<>();
    for (int termCount : termCounts) {
      result.put(termCount, readForTermCount(termCount));
    }
    return result;
  }

  public  H2ScoreDistributionReader(String pathDb, String tableName);

}