package com.ssj.conch.util.enums;

/**
 * @author yangcan
 * 类描述:年级枚举
 * 创建时间:2018年11月21日 下午7:55:21

 */
public enum GradeEnum {

	一年级("一年级",1),
	二年级("二年级",2),
	三年级("三年级",3),
	四年级("四年级",4),
	五年级("五年级",5),
	六年级("六年级",6),
	七年级("七年级",7),
	八年级("八年级",8),
	九年级("九年级",9),
	初一("初一",7),
	初二("初二",8),
	初三("初三",9),
	高一("高一",10),
	高二("高二",11),
	高三("高三",12);

	
	private GradeEnum(String grade, int index) {
		this.grade = grade;
		this.index = index;
	}
	private String grade;
	private int index;
	public String getGrade() {
		return grade;
	}
	public void setGrade(String grade) {
		this.grade = grade;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	
    public static int getIndexByGrade(String grade){
        for(GradeEnum gradeEnum:GradeEnum.values()){
            if(grade.equals(gradeEnum.getGrade())){
                return gradeEnum.getIndex();
            }
        }
        return 0;
    }
    
    public static void main(String[] args) {
		String grade = "级";
		System.out.println(GradeEnum.一年级.getIndex());
		System.out.println(GradeEnum.getIndexByGrade(grade));
	}
}
