Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class javax.speech.recognition.RuleCount

java.lang.Object
  |
  +--javax.speech.recognition.Rule
        |
        +--javax.speech.recognition.RuleCount

public class RuleCount
extends Rule
Attaches a count to a contained Rule object to indicate the number of times it may occur. The contained rule may occur optionally (zero or one times), one or more times, or zero or more times. The three count are equivalent to the "[]", "+" and "*" operators of the Java Speech Grammar Format.

Any Rule not contained by a RuleCount object occurs once only.

See Also:
Rule, RuleAlternatives, RuleGrammar, RuleName, RuleParse, RuleSequence, RuleTag, RuleToken, Serialized Form

Field Summary
int count
          Identifier for the rule count.
static int ONCE_OR_MORE
          ONCE_OR_MORE indicates that the Rule may be spoken one or more times.
static int OPTIONAL
          OPTIONAL indicates that the Rule is optional: zero or one occurrences.
Rule rule
          The rule to which the count applies.
static int ZERO_OR_MORE
          ZERO_OR_MORE indicates that the Rule may be spoken zero or more times.
 
Constructor Summary
RuleCount(Rule rule, int count)
          RuleCount constructor with contained rule and count.
RuleCount()
          Empty constructor sets rule to null and count to OPTIONAL.
 
Method Summary
Rule copy()
          Return a deep copy of this rule.
int getCount()
          Returns the count: OPTIONAL, ZERO_OR_MORE, ONCE_OR_MORE.
Rule getRule()
          Returns the contained Rule object.
void setCount(int count)
          Set the count.
void setRule(Rule rule)
          Set the contained Rule object.
String toString()
          Return a string representing the RuleCount object in partial Java Speech Grammar Format.
 
Methods inherited from class javax.speech.recognition.Rule
copy, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

rule

protected Rule rule
The rule to which the count applies.

count

protected int count
Identifier for the rule count.

See Also:
OPTIONAL, ONCE_OR_MORE, ZERO_OR_MORE

OPTIONAL

public static int OPTIONAL
OPTIONAL indicates that the Rule is optional: zero or one occurrences. An optional Rule is surrounded by "[]" in Java Speech Grammar Format.
See Also:
getCount

ONCE_OR_MORE

public static int ONCE_OR_MORE
ONCE_OR_MORE indicates that the Rule may be spoken one or more times. This is indicated by the "+" operator in Java Speech Grammar Format.
See Also:
getCount

ZERO_OR_MORE

public static int ZERO_OR_MORE
ZERO_OR_MORE indicates that the Rule may be spoken zero or more times. This is indicated by the "*" operator in Java Speech Grammar Format.
See Also:
getCount
Constructor Detail

RuleCount

public RuleCount(Rule rule,
                 int count)
RuleCount constructor with contained rule and count.

RuleCount

public RuleCount()
Empty constructor sets rule to null and count to OPTIONAL.
Method Detail

getRule

public Rule getRule()
Returns the contained Rule object.

setRule

public void setRule(Rule rule)
Set the contained Rule object.

getCount

public int getCount()
Returns the count: OPTIONAL, ZERO_OR_MORE, ONCE_OR_MORE.

See Also:
OPTIONAL, ZERO_OR_MORE, ONCE_OR_MORE

setCount

public void setCount(int count)
Set the count. If count is not one of the defined values OPTIONAL, ZERO_OR_MORE, ONCE_OR_MORE) the call is ignored.

See Also:
OPTIONAL, ZERO_OR_MORE, ONCE_OR_MORE

copy

public Rule copy()
Return a deep copy of this rule. See the Rule.copy documentation for an explanation of deep copy.
Overrides:
copy in class Rule

toString

public String toString()
Return a string representing the RuleCount object in partial Java Speech Grammar Format. The String represents the portion of Java Speech Grammar Format that could appear on the right hand side of a rule definition. Parenthesis will be placed around the contained Rule object if required. The output appears as one of:
   [ruleString]   // OPTIONAL
   ruleString *   // ZERO_OR_MORE
   ruleString +   // ONCE_OR_MORE
 
Overrides:
toString in class Rule

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com