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 Age, following JSAPI style.
12 * (http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-doc/)
14 * This is intended for use to define properties about FreeTTS voices.
18 public class Age implements Comparable {
19 private final String name;
21 // Ordinal of next created
22 private static int nextOrdinal = 0;
24 // Assign an ordinal to this age
25 private final int ordinal = nextOrdinal++;
27 private Age(String name) {this.name = name;}
30 * Provide a human readable string that describes the age.
32 * @return the name of the age
34 public String toString() {return name;}
37 * Compare two ages. CHILD is less than TEENAGER, and so on. If
38 * either age is DONT_CARE, then they are equal.
40 public int compareTo(Object o) {
41 if ((o == DONT_CARE) || (this == DONT_CARE)) {
44 return ordinal - ((Age) o).ordinal;
49 * Age roughly up to 12 years.
51 public static final Age CHILD = new Age("CHILD");
54 * Age roughly 13 to 19 years.
56 public static final Age TEENAGER = new Age("TEENAGER");
59 * Age roughly 20 to 40 years.
61 public static final Age YOUNGER_ADULT = new Age("YOUNGER_ADULT");
64 * Age roughly 40 to 60 years.
66 public static final Age MIDDLE_ADULT = new Age("MIDDLE_ADULT");
69 * Age roughly 60 years and up.
71 public static final Age OLDER_ADULT = new Age("OLDER_ADULT");
74 * An Age that is indeterminate.
76 public static final Age NEUTRAL = new Age("NEUTRAL");
79 * Matches against any Age.
81 public static final Age DONT_CARE = new Age("DONT_CARE");