Coverage Report - org.jtheque.films.services.impl.utils.search.filters.YearFilter
 
Classes in this File Line Coverage Branch Coverage Complexity
YearFilter
0 %
0/6
0 %
0/4
1.5
 
 1  
 package org.jtheque.films.services.impl.utils.search.filters;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *            
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License. 
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.films.persistence.od.able.Film;
 20  
 import org.jtheque.utils.collections.Filter;
 21  
 
 22  
 /**
 23  
  * A filter of year.
 24  
  *
 25  
  * @author Baptiste Wicht
 26  
  */
 27  0
 public final class YearFilter implements Filter<Film> {
 28  
     private final int from;
 29  
     private final int to;
 30  
 
 31  
     /**
 32  
      * Create a new YearFilter.
 33  
      *
 34  
      * @param from The from year.
 35  
      * @param to   The to year.
 36  
      */
 37  
     public YearFilter(int from, int to) {
 38  0
         super();
 39  
 
 40  0
         this.from = from;
 41  0
         this.to = to;
 42  0
     }
 43  
 
 44  
     @Override
 45  
     public boolean accept(Film person) {
 46  0
         return person.getYear() >= from && person.getYear() <= to;
 47  
     }
 48  
 }