001 package net.sf.cpsolver.studentsct.model;
002
003 import net.sf.cpsolver.ifs.util.ToolBox;
004
005 /**
006 * Academic area and code. This class is used for {@link Student#getAcademicAreaClasiffications()}, {@link Student#getMajors()}, and {@link Student#getMinors()}.
007 * <br><br>
008 *
009 * @version
010 * StudentSct 1.1 (Student Sectioning)<br>
011 * Copyright (C) 2007 Tomáš Müller<br>
012 * <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
013 * Lazenska 391, 76314 Zlin, Czech Republic<br>
014 * <br>
015 * This library is free software; you can redistribute it and/or
016 * modify it under the terms of the GNU Lesser General Public
017 * License as published by the Free Software Foundation; either
018 * version 2.1 of the License, or (at your option) any later version.
019 * <br><br>
020 * This library is distributed in the hope that it will be useful,
021 * but WITHOUT ANY WARRANTY; without even the implied warranty of
022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
023 * Lesser General Public License for more details.
024 * <br><br>
025 * You should have received a copy of the GNU Lesser General Public
026 * License along with this library; if not, write to the Free Software
027 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
028 */
029 public class AcademicAreaCode {
030 private String iArea, iCode;
031
032 /** Constructor
033 * @param area academic area
034 * @param code code
035 */
036 public AcademicAreaCode(String area, String code) {
037 iArea = area; iCode = code;
038 }
039
040 /** Academic area */
041 public String getArea() {
042 return iArea;
043 }
044
045 /** Code */
046 public String getCode() {
047 return iCode;
048 }
049
050 public int hashCode() {
051 return (iArea+":"+iCode).hashCode();
052 }
053
054 public boolean equals(Object o) {
055 if (o==null || !(o instanceof AcademicAreaCode)) return false;
056 AcademicAreaCode aac = (AcademicAreaCode)o;
057 return ToolBox.equals(aac.getArea(), getArea()) && ToolBox.equals(aac.getCode(), getCode());
058 }
059
060 public String toString() {
061 return getArea()+":"+getCode();
062 }
063 }