// Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/EvalPeristenceProvider.java
// public interface EvalPeristenceProvider extends Resource {
// 
//   void insertPartialMeasurements(Key key, String sequenceId, String calculatorName,
//           String evaluateeName, Map<Measure, Double> measure2value);
// 
//   Table<Key, Measure, List<Double>> selectPartialMeasurements(ExperimentKey experiment,
//           String calculatorName, String evaluateeName);
// 
//   void deletePartialMeasurements(Key key, String sequenceId, String calculatorName,
//           String evaluateeName);
// 
//   void insertAccumulatedMeasurements(Key key, String calculatorName, String evaluateeName,
//           Map<Measure, Double> measure2value);
// 
//   void deleteAccumulatedMeasurements(ExperimentKey experiment, String calculatorName,
//           String evaluateeName);
// 
// }
// 
// Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/Measure.java
// public interface Measure {
// 
//   String getName();
// 
//   Map<String, Measure> name2measure = new HashMap<>();
// 
//   static Measure forName(String name) {
//     return name2measure.get(name);
//   }
// 
// }


import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import edu.cmu.lti.oaqa.baseqa.eval.EvalPeristenceProvider;
import edu.cmu.lti.oaqa.baseqa.eval.Measure;
import edu.cmu.lti.oaqa.ecd.config.ConfigurableProvider;
import edu.cmu.lti.oaqa.ecd.phase.Trace;
import edu.cmu.lti.oaqa.framework.DataStoreImpl;
import edu.cmu.lti.oaqa.framework.eval.ExperimentKey;
import edu.cmu.lti.oaqa.framework.eval.Key;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowCallbackHandler;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
package edu.cmu.lti.oaqa.baseqa.eval.persistence;



public class JdbcEvalPersistenceProvider extends ConfigurableProvider implements
        EvalPeristenceProvider {

  @Override
  public void insertPartialMeasurements(Key key, String sequenceId, String calculatorName,
          String evaluateeName, Map<Measure, Double> measure2value) {
    String sql = (String) getParameterValue("insert-partial-meaurements-query");
    List<Map.Entry<Measure, Double>> pairs = new ArrayList<>(measure2value.entrySet());
    DataStoreImpl.getInstance().jdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter() {

// Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/EvalPeristenceProvider.java
// public interface EvalPeristenceProvider extends Resource {
// 
//   void insertPartialMeasurements(Key key, String sequenceId, String calculatorName,
//           String evaluateeName, Map<Measure, Double> measure2value);
// 
//   Table<Key, Measure, List<Double>> selectPartialMeasurements(ExperimentKey experiment,
//           String calculatorName, String evaluateeName);
// 
//   void deletePartialMeasurements(Key key, String sequenceId, String calculatorName,
//           String evaluateeName);
// 
//   void insertAccumulatedMeasurements(Key key, String calculatorName, String evaluateeName,
//           Map<Measure, Double> measure2value);
// 
//   void deleteAccumulatedMeasurements(ExperimentKey experiment, String calculatorName,
//           String evaluateeName);
// 
// }
// 
// Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/Measure.java
// public interface Measure {
// 
//   String getName();
// 
//   Map<String, Measure> name2measure = new HashMap<>();
// 
//   static Measure forName(String name) {
//     return name2measure.get(name);
//   }
// 
// }


// Path: src/main/java/edu/cmu/lti/oaqa/baseqa/eval/persistence/JdbcEvalPersistenceProvider.java
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import edu.cmu.lti.oaqa.baseqa.eval.EvalPeristenceProvider;
import edu.cmu.lti.oaqa.baseqa.eval.Measure;
import edu.cmu.lti.oaqa.ecd.config.ConfigurableProvider;
import edu.cmu.lti.oaqa.ecd.phase.Trace;
import edu.cmu.lti.oaqa.framework.DataStoreImpl;
import edu.cmu.lti.oaqa.framework.eval.ExperimentKey;
import edu.cmu.lti.oaqa.framework.eval.Key;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowCallbackHandler;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

package edu.cmu.lti.oaqa.baseqa.eval.persistence;



public class JdbcEvalPersistenceProvider extends ConfigurableProvider implements
        EvalPeristenceProvider {

  @Override
  public void insertPartialMeasurements(Key key, String sequenceId, String calculatorName,
          String evaluateeName, Map<Measure, Double> measure2value) {
    String sql = (String) getParameterValue("insert-partial-meaurements-query");
    List<Map.Entry<Measure, Double>> pairs = new ArrayList<>(measure2value.entrySet());
    DataStoreImpl.getInstance().jdbcTemplate().batchUpdate(sql, new BatchPreparedStatementSetter() {

      @Override