You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
list/src/main/java/data/MultipleHMKeys.java

50 lines
1.2 KiB

package data;
/*
Created for when words are sorted by multiple keys, i.e. not just lemmas but lemmas and msd simultaneously.
*/
final class MultipleHMKeys {
private final String key1, key2, key3;
public MultipleHMKeys(String key1) {
this.key1 = key1;
this.key2 = null;
this.key3 = null;
}
public MultipleHMKeys(String key1, String key2) {
this.key1 = key1;
this.key2 = key2;
this.key3 = null;
}
public MultipleHMKeys(String key1, String key2, String key3) {
this.key1 = key1;
this.key2 = key2;
this.key3 = key3;
}
public String getKey1() {
return key1;
}
public String getKey2() {
return key2;
}
public String getKey3() {
return key3;
}
@Override
public int hashCode() {
return key1.hashCode() ^ key2.hashCode() ^ key3.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj instanceof MultipleHMKeys) && ((MultipleHMKeys) obj).key1.equals(key1)
&& ((MultipleHMKeys) obj).key2.equals(key2)
&& ((MultipleHMKeys) obj).key3.equals(key3);
}
}