|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectSpeechLocale
public final class SpeechLocale
Encapsulates information that defines a locale
and provides match
ing functionality to facilitate Engine
selection and other local-sensitive operations.
The EngineMode
class contains examples of Engine
selection
with SpeechLocale
.
As described in the match
method, empty String
values
represent "don't care" during the selection process.
A SpeechLocale
associated with an Engine
instance
will contain non-empty String
values for language
and country
.
This class is compatible with java.util.Locale.
Engine
,
EngineMode
,
match
Constructor Summary | |
---|---|
SpeechLocale(String language)
Construct a SpeechLocale from the
language . |
|
SpeechLocale(String language,
String country)
Construct a SpeechLocale from the
language and country . |
|
SpeechLocale(String language,
String country,
String variant)
Construct a SpeechLocale from the
language , country , and variant . |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Returns true if and only if the parameter is a non-null
SpeechLocale with equal values for
language, country and variant. |
static SpeechLocale[] |
getAvailableLocales()
Returns a list of SpeechLocale s representing all
installed locales for the Java Virtual Machine. |
String |
getCountry()
Returns the country/region code for this SpeechLocale . |
static SpeechLocale |
getDefault()
Gets a SpeechLocale representing the current value of
the default locale for this instance of the Java Virtual Machine. |
String |
getLanguage()
Returns the language code for this SpeechLocale . |
String |
getVariant()
Returns the variant String for this SpeechLocale . |
int |
hashCode()
Returns a hash code value for this Object . |
boolean |
match(SpeechLocale require)
Determines whether this SpeechLocale has all the same values
for language, country, and variant as the require object. |
String |
toString()
Returns a String representation of this SpeechLocale . |
Methods inherited from class Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpeechLocale(String language) throws NullPointerException
SpeechLocale
from the
language
.
The country and variant are assigned the empty String
.
The corresponding accessor methods describe details about the
parameter values and possible conversions.
language
- a String
representing a language code
NullPointerException
- thrown if argument is nullgetLanguage
,
getCountry
,
getVariant
public SpeechLocale(String language, String country) throws NullPointerException
SpeechLocale
from the
language
and country
.
The variant is assigned the empty String
.
The corresponding accessor methods describe details about the
parameter values and possible conversions.
language
- a String
representing a language codecountry
- a String
representing a country/region code
NullPointerException
- thrown if either argument is nullgetLanguage
,
getCountry
,
getVariant
public SpeechLocale(String language, String country, String variant) throws NullPointerException
SpeechLocale
from the
language
, country
, and variant
.
The corresponding accessor methods describe details about the parameter values and possible conversions.
language
- a String
representing a language codecountry
- a String
representing a country/region codevariant
- a String
representing additional vendor-specific information
NullPointerException
- thrown if any argument is nullgetLanguage
,
getCountry
,
getVariant
Method Detail |
---|
public String getCountry()
SpeechLocale
.
Country codes specified in the constructor should correspond to
an uppercase ISO 3166 code or the empty String
.
If needed, specified values are converted to uppercase.
Because country values are converted, avoid direct String
comparison and only compare values obtained through this method.
SpeechLocale
.public String getVariant()
String
for this SpeechLocale
.
The variant specified in the constructor may be any String
including the empty String
.
String
for this SpeechLocale
.public String getLanguage()
SpeechLocale
.
Language codes specified in the constructor should correspond to
a lowercase ISO 639 code or the empty String
.
If needed, specified values are converted to lowercase.
For backward compatibility, the codes
"he", "yi", and "id"
are converted to the codes
"iw", "ji", and "in", respectively.
Because language values are converted, avoid direct String
comparison and only compare values obtained through this method.
SpeechLocale
.public String toString()
String
representation of this SpeechLocale
.
This method follows the conventions of java.util.Locale
.
In particular, the language, country, and variant are separated by underbars.
The variant is included only if the language and country are not the empty String
.
The language and country are lower and uppercase, respectively.
toString
in class Object
String
representation of this SpeechLocale
public static SpeechLocale[] getAvailableLocales()
SpeechLocale
s representing all
installed locales for the Java Virtual Machine.
The getDefault
method describes the use of SpeechLocale
s
in Engine
selection.
SpeechLocale
sgetDefault
public static SpeechLocale getDefault()
SpeechLocale
representing the current value of
the default locale for this instance of the Java Virtual Machine.
The EngineManager
class describes the process of selecting a
speech Engine
using a SpeechLocale
.
Note that the SpeechLocale
of an Engine
selected with the DEFAULT
for an EngineMode
subclass
may differ from the return value of this method.
Furthermore, a speech Engine
of the desired subclass
corresponding to the returned SpeechLocale
may not exist.
SpeechLocale
representing the default locale for this JVMEngineManager
,
Engine
,
EngineMode
public int hashCode()
Object
.
This method is supported for the benefit of hashtables.
hashCode
in class Object
Object
.public boolean equals(Object obj)
true
if and only if the parameter is a non-null
SpeechLocale
with equal values for
language, country and variant.
equals
in class Object
obj
- an Object
to compare
true
if obj
equals this SpeechLocale
getLanguage
,
getCountry
,
getVariant
public boolean match(SpeechLocale require)
SpeechLocale
has all the same values
for language, country, and variant as the require
object.
Empty String
values in require
are not tested
("don't care").
The accessor methods for language and country describe possible
value conversions that apply before comparison.
All String
comparisons are exact (case-sensitive).
require
- a SpeechLocale
to compare
true
if this SpeechLocale
has
all the require
d valuesgetLanguage
,
getCountry
,
getVariant
|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Speech API 2.0,
Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.