package data; import java.util.ArrayList; import java.util.Objects; /* Created for when words are sorted by multiple keys, i.e. not just lemmas but lemmas and msd simultaneously. */ public interface MultipleHMKeys { String getK1(); default String getK2(){ return null; } default String getK3(){ return null; } default String getK4(){ return null; } default String getK5(){ return null; } default ArrayList getSplittedMultipleHMKeys(){ return null; } default String getMsd(Filter filter) { String msd = ""; if (filter.getCalculateFor().equals(CalculateFor.MORPHOSYNTACTIC_SPECS)){ msd = getK1(); } else if (filter.getMultipleKeys().contains(CalculateFor.MORPHOSYNTACTIC_SPECS)) { int i = 0; for (CalculateFor otherKey : filter.getMultipleKeys()) { switch (i) { case 0: if (otherKey.equals(CalculateFor.MORPHOSYNTACTIC_SPECS)) { msd = getK2(); } break; case 1: if (otherKey.equals(CalculateFor.MORPHOSYNTACTIC_SPECS)) { msd = getK3(); } break; case 2: if (otherKey.equals(CalculateFor.MORPHOSYNTACTIC_SPECS)) { msd = getK4(); } break; case 3: if (otherKey.equals(CalculateFor.MORPHOSYNTACTIC_SPECS)) { msd = getK5(); } break; } i++; } } return msd; } @Override int hashCode(); @Override boolean equals(Object obj); }