package data.Enums; import java.util.HashMap; public enum Msd { NOUN("samostalnik", 'S', "Noun", 'N', 5), VERB("glagol", 'G', "Verb", 'V', 7), ADJECTIVE("pridevnik", 'P', "Adjective", 'A', 6), ADVERB("prislov", 'R', "Adverb", 'R', 2), PRONOUN("zaimek", 'Z', "Pronoun", 'P', 8), NUMERAL("števnik", 'K', "Numeral", 'M', 6), PREPOSITION("predlog", 'D', "Preposition", 'S', 1), CONJUNCTION("veznik", 'V', "Conjunction", 'C', 1), PARTICLE("členek", 'L', "Particle", 'Q', 0), INTERJECTION("medmet", 'M', "Interjection", 'I', 0), ABBREVIATION("okrajšava", 'O', "Abbreviation", 'Y', 0), RESIDUAL("neuvrščeno", 'N', "Residual", 'X', 1); private final String siName; private final Character siCode; private final String enName; private final Character enCode; private final Integer nOfAttributes; private static HashMap siCodeNOfAttributes; static { siCodeNOfAttributes = new HashMap<>(); for (Msd msd : Msd.values()) { siCodeNOfAttributes.put(msd.getSiCode(), msd.nOfAttributes); } } Msd(String siName, Character siCode, String enName, Character enCode, int nOfAttributes) { this.siName = siName; this.siCode = siCode; this.enName = enName; this.enCode = enCode; this.nOfAttributes = nOfAttributes; } public String getSiName() { return siName; } public Character getSiCode() { return siCode; } public String getEnName() { return enName; } public Character getEnCode() { return enCode; } /** * Returns the number of attributes for the given type. * * @param msd * * @return */ public static int getMsdLengthForType(String msd) { return siCodeNOfAttributes.get(msd.charAt(0)) + 1; } }