package iitb.cfilt.cpost.lexicon;

public class StemFeatures {
	char clas;
	char gender;
	String ending;
	
	StemFeatures(){
		clas = ' ';
		gender = 'F';
		ending = "";
	}
	StemFeatures(char clas, char gender, String askSmriti){
		this.clas = clas;
		this.gender = gender;
		this.ending = askSmriti;
	}
	StemFeatures(StemFeatures sf){
		this.clas = sf.clas;
		this.gender = sf.gender;
		this.ending = sf.ending;
	}	
	
	public boolean isEqual(StemFeatures sf){
		boolean retVal = false;
		boolean matchClas = ((this.clas == sf.clas) || sf.clas == 'X' || this.clas == 'X');
		boolean matchGender = ((this.gender == sf.gender) || sf.gender == 'X' || this.gender == 'X');
		boolean matchEnding = ((this.ending.equals(sf.ending)) || sf.ending.equals("X") || this.ending.equals("X"));
		retVal = matchClas && matchGender && matchEnding;
		return retVal;
	}
	
	public char getClas(){
		return clas;
	}
	public void print(){
		System.out.println("[ Class : " + clas + ", Gender : " + gender + ", Last : " + ending + " ]");
	}
	public char getGender(){
		return gender;
	}
	public String getEnding() {
		return ending;
	}
	public void setEnding(String ending) {
		this.ending = ending;
	}
	public void setClas(char clas) {
		this.clas = clas;
	}
	public void setGender(char gender) {
		this.gender = gender;
	}
	public void setGender(String gender) {
		if(gender.trim().startsWith("+")){
			this.gender = 'M';
		}
		else{
			this.gender = 'F';
		}
		
	}
	public String getGenderString(){
		if(this.gender=='M'){
			return "+masc";			
		}
		else{
			return "-masc";
		}
	}
	
}
