package cn.com.qmth.stmms.biz.exam.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class MarkGroupPK implements Serializable {

    private static final long serialVersionUID = -7637998031337761686L;

    @Column(name = "exam_id", nullable = false)
    private Integer examId;

    @Column(name = "subject_code", nullable = false, length = 32)
    private String subjectCode;

    @Column(name = "number", nullable = false)
    private Integer number;

    public Integer getExamId() {
        return examId;
    }

    public void setExamId(Integer examId) {
        this.examId = examId;
    }

    public String getSubjectCode() {
        return subjectCode;
    }

    public void setSubjectCode(String subjectCode) {
        this.subjectCode = subjectCode;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((examId == null) ? 0 : examId.hashCode());
        result = PRIME * result + ((subjectCode == null) ? 0 : subjectCode.hashCode());
        result = PRIME * result + ((number == null) ? 0 : number.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        final MarkGroupPK other = (MarkGroupPK) obj;
        if (examId == null) {
            if (other.examId != null)
                return false;
        } else if (!examId.equals(other.examId))
            return false;
        if (subjectCode == null) {
            if (other.subjectCode != null)
                return false;
        } else if (!subjectCode.equals(other.subjectCode))
            return false;

        if (number == null) {
            if (other.number != null)
                return false;
        } else if (!number.equals(other.number))
            return false;

        return true;
    }

}
