@Test void readAll() throws Exception{ Map<Integer, ScoreDistribution> results = objDbReader.readAll(); assertEquals(results.size(), 1); }
@Override public Map<Integer, ScoreDistribution> readAll() throws PhenolException { 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); } final Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int termCount : termCounts) { result.put(termCount, readForTermCount(termCount)); } return result; }
H2ScoreDistributionReader implements ScoreDistributionReader { @Override public Map<Integer, ScoreDistribution> readAll() throws PhenolException { 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); } final Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int termCount : termCounts) { result.put(termCount, readForTermCount(termCount)); } return result; } }
H2ScoreDistributionReader implements ScoreDistributionReader { @Override public Map<Integer, ScoreDistribution> readAll() throws PhenolException { 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); } final Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int termCount : termCounts) { result.put(termCount, readForTermCount(termCount)); } return result; } H2ScoreDistributionReader(String pathDb, String tableName); }
H2ScoreDistributionReader implements ScoreDistributionReader { @Override public Map<Integer, ScoreDistribution> readAll() throws PhenolException { 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); } final Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int termCount : termCounts) { result.put(termCount, readForTermCount(termCount)); } return result; } H2ScoreDistributionReader(String pathDb, String tableName); @Override ObjectScoreDistribution readForTermCountAndObject(int termCount, TermId objectId); @Override ScoreDistribution readForTermCount(int termCount); @Override Map<Integer, ScoreDistribution> readAll(); @Override void close(); }
H2ScoreDistributionReader implements ScoreDistributionReader { @Override public Map<Integer, ScoreDistribution> readAll() throws PhenolException { 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); } final Map<Integer, ScoreDistribution> result = new HashMap<>(); for (int termCount : termCounts) { result.put(termCount, readForTermCount(termCount)); } return result; } H2ScoreDistributionReader(String pathDb, String tableName); @Override ObjectScoreDistribution readForTermCountAndObject(int termCount, TermId objectId); @Override ScoreDistribution readForTermCount(int termCount); @Override Map<Integer, ScoreDistribution> readAll(); @Override void close();  }