Copyright (c) 2015, Marius Fink - Universit?t Hamburg
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following ...
If you think the Android project android-continuous-voice listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package de.uniHamburg.informatik.continuousvoice.settings;
/*fromwww.java2s.com*/publicenum Language {
EnUs("en-US", "en", "eng-USA"), DeDe("de-DE", "de", "deu-DEU");
privatefinal String code2;
privatefinal String code4;
privatefinal String code6;
private Language(String code4, String code2, String code6) {
this.code2 = code2;
this.code4 = code4;
this.code6 = code6;
}
publicboolean equalsName(String otherName) {
boolean result = false;
if (otherName == null) {
return false;
}
switch (otherName.length()) {
case 2:
result = getCode2().equalsIgnoreCase(otherName);
break;
case 5:
result = getCode4().equalsIgnoreCase(otherName);
break;
case 7:
result = getCode6().equalsIgnoreCase(otherName);
break;
}
return result;
}
public String getCode6() {
return code6;
}
public String getCode4() {
return code4;
}
public String getCode2() {
return code2;
}
publicstatic Language getByName(String name) {
if (name.equalsIgnoreCase("de") || name.equalsIgnoreCase("de-de") || name.equalsIgnoreCase("deu-deu")) {
return DeDe;
} elseif (name.equalsIgnoreCase("en") || name.equalsIgnoreCase("en-us") || name.equalsIgnoreCase("eng-usa")) {
return EnUs;
} else {
return null;
}
}
public String toString() {
return getCode4();
}
}