|
JSAPI 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectRuleComponent
RuleCount
public class RuleCount
Attaches repeat counts to a contained RuleComponent
object to
indicate the number of times it may occur.
The contained RuleComponent
may occur optionally (zero or one times),
zero or more times, one or more times, up to a maximum, at least a minimum,
and within a range.
This class supports the following common cases from formal language theory:
"[]" (optional), "*" (zero or more - Kleene star)
and "+" (one or more - positive closure).
Any RuleComponent
not contained by a RuleCount
object
occurs once only.
Probabilities normally in the range of 0
to 1.0
should be scaled to the range of 0
to MAX_PROBABILITY
.
MAX_PROBABILITY
Field Summary | |
---|---|
static int |
MAX_PROBABILITY
The maximum repeat probability for a RuleCount . |
static int |
REPEAT_INDEFINITELY
A value that represents indefinite repeating for a RuleCount . |
Constructor Summary | |
---|---|
RuleCount(RuleComponent ruleComponent,
int repeatMin)
Constructs a RuleCount specifying the minimum number
of times a RuleComponent must repeat. |
|
RuleCount(RuleComponent ruleComponent,
int repeatMin,
int repeatMax)
Constructs a RuleCount specifying a range for repeating
a RuleComponent . |
|
RuleCount(RuleComponent ruleComponent,
int repeatMin,
int repeatMax,
int repeatProbability)
Constructs a RuleCount specifying a range for
repeating a RuleComponent with a probability. |
Method Summary | |
---|---|
int |
getRepeatMax()
Returns the maximum repeat count for this RuleCount . |
int |
getRepeatMin()
Returns the minimum repeat count for this RuleCount . |
int |
getRepeatProbability()
Returns the repeat probability for this RuleCount . |
RuleComponent |
getRuleComponent()
Returns the RuleComponent to which the counts
and probability apply. |
String |
toString()
Returns a String representing this RuleComponent
as grammar text. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_PROBABILITY
RuleCount
.
Probabilities normally in the range of 0
to 1.0
should be scaled to the range of 0
to MAX_PROBABILITY
.
RuleCount(RuleComponent, int, int, int)
,
Constant Field Valuespublic static final int REPEAT_INDEFINITELY
RuleCount
.
RuleCount(RuleComponent, int, int, int)
,
Constant Field ValuesConstructor Detail |
---|
public RuleCount(RuleComponent ruleComponent, int repeatMin) throws IllegalArgumentException
RuleCount
specifying the minimum number
of times a RuleComponent
must repeat.
repeatMin
of 0
represents 0
or more (Kleene star)
and repeatMin
of 1
represents the positive closure.
repeatMin must be greater than or equal to 0
.
ruleComponent
- the RuleComponent
to which the counts applyrepeatMin
- the minimum repeat count
IllegalArgumentException
- if repeatMin
is
less than 0
getRuleComponent
,
getRepeatMin
public RuleCount(RuleComponent ruleComponent, int repeatMin, int repeatMax) throws IllegalArgumentException
RuleCount
specifying a range for repeating
a RuleComponent
.
A repeatMin
of 0
and a repeatMax
of 1
means that this RuleComponent
is optional.
repeatMin
must be greater than or equal to 0
and
less than or equal to repeatMax
.
ruleComponent
- the RuleComponent
to which the counts applyrepeatMin
- the minimum repeat countrepeatMax
- the maximum repeat count
IllegalArgumentException
- if repeatMin
is
less than 0
or
if repeatMin
is greater than repeatMax
getRuleComponent
,
getRepeatMin
,
getRepeatMax
public RuleCount(RuleComponent ruleComponent, int repeatMin, int repeatMax, int repeatProbability) throws IllegalArgumentException
RuleCount
specifying a range for
repeating a RuleComponent
with a probability.
repeatMin
must be greater than or equal to 0
and
less than or equal to repeatMax
.
repeatProbability
must be between
0
and MAX_PROBABILITY
.
When repeatMax
is REPEAT_INDEFINITELY
,
the ruleComponent
is repeated an indefinite number of times.
ruleComponent
- the RuleComponent
to which the counts applyrepeatMin
- the minimum repeat countrepeatMax
- the maximum repeat countrepeatProbability
- the repeat probability
IllegalArgumentException
- if repeatMin
is
less than 0
or
if repeatMin
is greater than repeatMax
or if repeatProbability is not with rangegetRuleComponent
,
getRepeatMin
,
getRepeatMax
,
getRepeatProbability
,
MAX_PROBABILITY
,
REPEAT_INDEFINITELY
Method Detail |
---|
public int getRepeatMin()
RuleCount
.
RuleCount
public int getRepeatMax()
RuleCount
.
Returns REPEAT_INDEFINITELY
if not specified in the constructor.
RuleCount
public int getRepeatProbability()
RuleCount
.
Returns MAX_PROBABILITY
if not specified in the constructor.
RuleCount
public RuleComponent getRuleComponent()
RuleComponent
to which the counts
and probability apply.
RuleComponent
to which the counts
and probability apply.public String toString()
String
representing this RuleComponent
as grammar text.
The String
represents a portion of a grammar that could appear
on the right hand side of a Rule
definition.
toString
in class RuleComponent
String
representing grammar text.RuleComponent
,
Rule
|
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.