VoiceVariant.java: Use MALE and FEMALE string constants.

This commit is contained in:
Reece H. Dunn
2013-09-04 13:42:52 +01:00
parent 26d1141ad2
commit 00bc5f2c6c
3 changed files with 11 additions and 8 deletions
@@ -21,15 +21,18 @@ import java.util.regex.Pattern;
public class VoiceVariant {
private static final Pattern mVariantPattern = Pattern.compile("-");
public static final String MALE = "male";
public static final String FEMALE = "female";
public final String variant;
public final int gender;
public final int age;
protected VoiceVariant(String variant, int age) {
if (variant.equals("male")) {
if (variant.equals(MALE)) {
this.variant = null;
this.gender = SpeechSynthesis.GENDER_MALE;
} else if (variant.equals("female")) {
} else if (variant.equals(FEMALE)) {
this.variant = null;
this.gender = SpeechSynthesis.GENDER_FEMALE;
} else {
@@ -43,9 +46,9 @@ public class VoiceVariant {
public String toString() {
final String ret;
if (gender == SpeechSynthesis.GENDER_MALE) {
ret = "male";
ret = MALE;
} else if (gender == SpeechSynthesis.GENDER_FEMALE) {
ret = "female";
ret = FEMALE;
} else {
ret = variant;
}