package morphology.parser; /** * Encapsulation of noun ending features. * * Project: NGSLT --> NLP --> Words --> Assignment #1 * @author Normunds Grūzītis, Gunta Nešpore, Baiba Saulīte * @date February 2006 */ public class NounEndingFeature extends EndingFeature { private String decl; private String number; private String icase; /** * Constructor. * @param decl declension. * @param number person number. * @param icase inflectional case. */ public NounEndingFeature(String decl, String number, String icase) { this.decl = decl; this.number = number; this.icase = icase; } /** * Gets inflectional paradigm of the ending. * @return code of the paradigm (e.g., 'D1', 'D2'). */ public String getParadigm() { return decl; } /** * Gets person number represented by the ending. * @return number (e.g., 'SG' or 'PL'). */ public String getNumber() { return number; } /** * Gets inflectional case represented by the ending. * @return case (e.g., 'NOM', 'GEN'). */ public String getCase() { return icase; } /** * Indicates whether some other feature is equal by content to this one. * @param obj the reference object with which to compare. * @return true if this feature is the same as the argument; false otherwise. */ public boolean equals(Object obj) { boolean isEqual = false; if (obj instanceof NounEndingFeature) { NounEndingFeature feature = (NounEndingFeature)obj; if (feature.getParadigm().equals(decl) && feature.getNumber().equals(number) && feature.getCase().equals(icase)) { isEqual = true; } } return isEqual; } /** * Gives string representation of this feature object. * @return feature string. */ public String toString() { return decl + " " + number + " " + icase; } }