001 package net.sf.cpsolver.studentsct.filter;
002
003 import net.sf.cpsolver.studentsct.model.Student;
004
005 /**
006 * This student filter accepts students that are not accepted by the provided student filter.
007 *
008 * @version
009 * StudentSct 1.1 (Student Sectioning)<br>
010 * Copyright (C) 2007 Tomáš Müller<br>
011 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
012 * Lazenska 391, 76314 Zlin, Czech Republic<br>
013 * <br>
014 * This library is free software; you can redistribute it and/or
015 * modify it under the terms of the GNU Lesser General Public
016 * License as published by the Free Software Foundation; either
017 * version 2.1 of the License, or (at your option) any later version.
018 * <br><br>
019 * This library is distributed in the hope that it will be useful,
020 * but WITHOUT ANY WARRANTY; without even the implied warranty of
021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
022 * Lesser General Public License for more details.
023 * <br><br>
024 * You should have received a copy of the GNU Lesser General Public
025 * License along with this library; if not, write to the Free Software
026 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
027 */
028
029 public class ReverseStudentFilter implements StudentFilter {
030 private StudentFilter iFilter = null;
031
032 /**
033 * Constructor
034 * @param filter student filter that is to be reversed
035 */
036 public ReverseStudentFilter(StudentFilter filter) {
037 iFilter = filter;
038 }
039
040 /**
041 * Accept student. Student is accepted if the provided student filter refuses him/her.
042 **/
043 public boolean accept(Student student) {
044 return (iFilter==null?false:!iFilter.accept(student));
045 }
046
047 }