2 * Copyright 2001 Sun Microsystems, Inc.
4 * See the file "license.terms" for information on usage and
5 * redistribution of this file, and for a DISCLAIMER OF ALL
8 package com.sun.speech.freetts;
11 * Provides an enumeration of Gender, following the JSAPI style.
12 * (http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-doc/)
14 * These are intended for use to define properties about FreeTTS
19 public class Gender implements Comparable {
20 private final String name;
22 // Ordinal of next created
23 private static int nextOrdinal = 0;
25 // Assign an ordinal to this gender
26 private final int ordinal = nextOrdinal++;
28 private Gender(String name) {this.name = name;}
31 * Generates a human readable name describing the gender.
33 * @return the name of the gender
35 public String toString() {return name;}
38 * Compare two genders. If either is DONT_CARE, then returns 0.
40 public int compareTo(Object o) {
41 if ((o == DONT_CARE) || (this == DONT_CARE)) {
44 return ordinal - ((Gender) o).ordinal;
51 public static final Gender MALE = new Gender("MALE");
56 public static final Gender FEMALE = new Gender("FEMALE");
59 * Neutral such as a robot or artificial.
61 public static final Gender NEUTRAL = new Gender("NEUTRAL");
64 * Match against all other genders.
66 public static final Gender DONT_CARE = new Gender("DONT_CARE");