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