@Override public Observable<JobRow> getFilteredRows(Set<JobRowFilter> jobRowFilters) throws IllegalArgumentException { return getAllRows().filter(jobRow -> satisfiesFilters(jobRowFilters, jobRow)); }
/** * This method checks if the given JobRow satisfies all the JobRowFilters and returns true if it does. * If a JobField in any of the filters is not a part of the JobRow, this method throws an IllegalArgumentException. * * @param jobRowFilters A Set of JobRowFilters specifying the different conditions to be satisfied * @param jobRow The JobRow which needs to be inspected * * @return true if the JobRow satisfies all the filters, false otherwise * * @throws IllegalArgumentException if a JobField in any of the filters is not a part the JobRow */ private boolean satisfiesFilters(Set<JobRowFilter> jobRowFilters, JobRow jobRow) throws IllegalArgumentException { return jobRowFilters.stream().allMatch(filter -> satisfiesFilter(jobRow, filter)); }
ApiJobStore apiJobStore = new HashJobStore();
ApiJobStore apiJobStore = new HashJobStore();