upstream version 1.2.2
[debian/freetts] / com / sun / speech / freetts / FeatureSet.java
1 /**
2  * Portions Copyright 2001 Sun Microsystems, Inc.
3  * Portions Copyright 1999-2001 Language Technologies Institute, 
4  * Carnegie Mellon University.
5  * All Rights Reserved.  Use is subject to license terms.
6  * 
7  * See the file "license.terms" for information on usage and
8  * redistribution of this file, and for a DISCLAIMER OF ALL 
9  * WARRANTIES.
10  */
11 package com.sun.speech.freetts;
12
13 import java.io.PrintWriter;
14
15 /**
16  * Represents the abstract interface to an entity that has
17  * a set of features. Provides interfaces to set and get the name/value
18  * pairs as well as providing a set of convenience methods for
19  * setting and retrieving values of a particular type.
20  */
21
22 public interface FeatureSet extends Dumpable {
23
24
25     /**
26      * Determines if the given feature is present.
27      *
28      * @param name the name of the feature of interest
29      *
30      * @return true if the named feature is present
31      */
32     public boolean isPresent(String name);
33
34
35     /**
36      * Removes the named feature from this set of features.
37      *
38      * @param name the name of the feature of interest
39      */
40     public void remove(String name);
41
42     /**
43      * Convenience method that returns the named feature as a string.
44      *
45      * @param name the name of the feature
46      *
47      * @return the value associated with the name or null if the value
48      *   is not found
49      *
50      * @throws ClassCastException if theassociated value is not a
51      *   String
52      */
53     public String getString(String name);
54
55     /**
56      * Convenience method that returns the named feature as an int.
57      *
58      * @param name the name of the feature
59      *
60      * @return the value associated with the name or null if the value
61      *   is not found
62      *
63      * @throws ClassCastException if the associated value is not an
64      *   int
65      */
66     public int getInt(String name);
67
68     /**
69      * Convenience method that returns the named feature as a float.
70      *
71      * @param name the name of the feature
72      *
73      * @return the value associated with the name or null if the value
74      *   is not found
75      *
76      * @throws ClassCastException if the associated value is not a
77      *   float.
78      */
79     public float getFloat(String name);
80
81     /**
82      * Returns the named feature as an object.
83      *
84      * @param name the name of the feature
85      *
86      * @return the value associated with the name or null if the value
87      *   is not found
88      */
89     public Object getObject(String name);
90
91     /**
92      * Convenience method that sets the named feature as an int.
93      *
94      * @param name the name of the feature
95      * @param value the value of the feature
96      */
97     public void setInt(String name, int value);
98
99     /**
100      * Convenience method that sets the named feature as a float
101      *
102      * @param name the name of the feature
103      * @param value the value of the feature
104      */
105     public void setFloat(String name, float value);
106
107     /**
108      * Convenience method that sets the named feature as a String.
109      *
110      * @param name the name of the feature
111      * @param value the value of the feature
112      */
113     public void setString(String name, String value);
114
115     /**
116      * Sets the named feature .
117      *
118      * @param name the name of the feature
119      * @param value the value of the feature
120      */
121     public void setObject(String name, Object value);
122
123     /**
124      * Dumps the FeatureSet in textual form.
125      *
126      * @param output where to send the formatted output
127      * @param pad the padding
128      * @param title the title
129      */
130     public void dump(PrintWriter output, int pad, String title);
131 }