Exemple #1
0
 @Override
 public synchronized JobList list(ListQuery query) {
   JobList results = new InMemoryJobList();
   for (long i = 0, scroll = 0; results.size() < query.getLimit() && i < this.jobs.size(); i++) {
     Job job = this.jobs.get((int) i);
     if (this.matches(job, query)) {
       scroll++;
       if (scroll > query.getOffset()) {
         results.add(job);
       }
     }
   }
   return results;
 }
Exemple #2
0
 private boolean matches(Job job, ListQuery query) {
   if (!query.getStatuses().contains(job.getStatus())) {
     return false;
   }
   return true;
 }