001package org.cpsolver.studentsct.model;
002
003import org.cpsolver.ifs.util.ToolBox;
004
005/**
006 * Academic area, classification, and major code. This class is used for
007 * {@link Student#getAreaClassificationMajors()}. <br>
008 * <br>
009 * 
010 * @version StudentSct 1.3 (Student Sectioning)<br>
011 *          Copyright (C) 2007 - 2014 Tomas Muller<br>
012 *          <a href="mailto:muller@unitime.org">muller@unitime.org</a><br>
013 *          <a href="http://muller.unitime.org">http://muller.unitime.org</a><br>
014 * <br>
015 *          This library is free software; you can redistribute it and/or modify
016 *          it under the terms of the GNU Lesser General Public License as
017 *          published by the Free Software Foundation; either version 3 of the
018 *          License, or (at your option) any later version. <br>
019 * <br>
020 *          This library is distributed in the hope that it will be useful, but
021 *          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. <br>
024 * <br>
025 *          You should have received a copy of the GNU Lesser General Public
026 *          License along with this library; if not see
027 *          <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>.
028 */
029public class AreaClassificationMajor {
030    private String iArea, iClassification, iMajor;
031
032    /**
033     * Constructor
034     * 
035     * @param area academic area
036     * @param classification academic classification
037     * @param major major
038     */
039    public AreaClassificationMajor(String area, String classification, String major) {
040        iArea = area;
041        iClassification = classification;
042        iMajor = major;
043    }
044
045    /** Academic area 
046     * @return academic area abbreviation
047     **/
048    public String getArea() {
049        return iArea;
050    }
051
052    /** Academic classification 
053     * @return classification code
054     **/
055    public String getClassification() {
056        return iClassification;
057    }
058    
059    /** Major 
060     * @return major code
061     **/
062    public String getMajor() {
063        return iMajor;
064    }
065
066    @Override
067    public int hashCode() {
068        return toString().hashCode();
069    }
070
071    @Override
072    public boolean equals(Object o) {
073        if (o == null || !(o instanceof AreaClassificationMajor))
074            return false;
075        AreaClassificationMajor acm = (AreaClassificationMajor) o;
076        return ToolBox.equals(acm.getArea(), getArea()) && ToolBox.equals(acm.getClassification(), getClassification()) && ToolBox.equals(acm.getMajor(), getMajor());
077    }
078
079    @Override
080    public String toString() {
081        return getArea() + "/" + getMajor() + " " + getClassification();
082    }
083}