public static void connectProjectsWithUsers() throws Exception { List<ResponseProjects> responseProjectsList = ResponseProjects.fromCsvFile(new File("data/RohantwortenUmfrage2Kopie.csv")); List<Project> projs = Project.projectListFromCsv( CsvHelpers.parseCsv(new File("data/KandidatenProjekteUmfrage2.csv"))); for (ResponseProjects rp : responseProjectsList) { rp.user = UserGuesser.guessUserWithProjects(rp, projs); Helpers.log("Guessed user: "******"data/userEstimates.csv")); saveListOfProjectsWithResponse(responseProjectsList, projs); }
private static void saveListOfProjectsWithResponse( final List<ResponseProjects> results, List<Project> projs) throws Exception { IPredicate<Project> hasResponse = new IPredicate<Project>() { @Override public boolean invoke(final Project p) { IPredicate<ResponseProjects> isProject = new IPredicate<ResponseProjects>() { @Override public boolean invoke(ResponseProjects rps) { return rps.toProjectList().contains(p); } }; return Func.contains(isProject, results); } }; List<Project> projsWithResp = Func.filter(hasResponse, projs); CsvData projsWithRespCsv = Project.projectListToCsv(projsWithResp); projsWithRespCsv.save(new File("data/projsWithResponses.csv")); }