|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectRule
public class Rule
Represents a Rule
in a RuleGrammar
.
Each Rule
in a RuleGrammar
defines a named grammar rule
in terms of RuleComponent
s.
In traditional grammar terminology,
the name of the Rule
represents the left-hand side (LHS) and
the RuleComponent
expansion represents the right-hand side (RHS).
The RuleGrammar
class defines how to create and use
a Grammar
with Rule
s.
At least one Rule
within a RuleGrammar
must have
PUBLIC
scope to allow external reference with a Rule
name.
Otherwise, a single root Rule
must be defined
in the associated RuleGrammar (see createRuleGrammar
).
Grammar
,
RuleGrammar
,
createRuleGrammar
Field Summary | |
---|---|
static int |
PRIVATE
A constant that specifies private scope for a Rule . |
static int |
PUBLIC
A constant that specifies public scope for a Rule . |
Constructor Summary | |
---|---|
Rule(String ruleName,
RuleComponent ruleComponent)
Constructs a Rule with a name and RuleComponent
expansion. |
|
Rule(String ruleName,
RuleComponent ruleComponent,
int scope)
Constructs a Rule with a name, RuleComponent expansion,
and scope. |
Method Summary | |
---|---|
RuleComponent |
getRuleComponent()
Gets the RuleComponent expansion of this Rule . |
String |
getRuleName()
Gets the name of this Rule. |
int |
getScope()
Gets the scope of this Rule . |
String |
toString()
Returns a String representing this Rule
as grammar text. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int PUBLIC
Rule
.
PRIVATE
,
getScope
,
Rule
,
Constant Field Valuespublic static final int PRIVATE
Rule
.
PUBLIC
,
getScope
,
Rule
,
Constant Field ValuesConstructor Detail |
---|
public Rule(String ruleName, RuleComponent ruleComponent) throws IllegalArgumentException
Rule
with a name and RuleComponent
expansion.
The Rule
uses the default PRIVATE
scope.
ruleName
- the name of this Rule
ruleComponent
- the expansion for this Rule
IllegalArgumentException
- if ruleName
is not valid
grammar text or ruleComponent
is null
getRuleName
,
getRuleComponent
,
getScope
public Rule(String ruleName, RuleComponent ruleComponent, int scope) throws IllegalArgumentException
Rule
with a name, RuleComponent
expansion,
and scope.
The scope is either PUBLIC
or PRIVATE
.
PUBLIC
scope Rule
s may be referenced
by other Rule
s both locally within the same RuleGrammar
and externally by other RuleGrammar
s.
PRIVATE
scope Rule
s may only be referenced locally
by name within the RuleGrammar
.
Rule
s are referenced with RuleReference
s.
ruleName
- the name of this Rule
ruleComponent
- the expansion for this Rule
scope
- the scope of this Rule
IllegalArgumentException
- if ruleName
is not valid
grammar text, ruleComponent
is null
,
or if scope
is invalidgetRuleName
,
getRuleComponent
,
getScope
,
RuleGrammar
,
RuleReference
Method Detail |
---|
public String getRuleName()
Rule
.
Rule
public RuleComponent getRuleComponent()
RuleComponent
expansion of this Rule
.
The expansion defines how this Rule
matches speech.
public int getScope()
Rule
.
The scope is either PUBLIC
or PRIVATE
.
It is specified in the Rule
constructor.
PUBLIC
,
PRIVATE
,
Rule(String, RuleComponent, int)
public String toString()
String
representing this Rule
as grammar text.
The String
represents a portion of a RuleGrammar
defined by a Rule
name and associated RuleComponent
expansion.
toString
in class Object
String
representing grammar text.getRuleName
,
getRuleComponent
|
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.