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.RuleTag

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

public class RuleTag
extends Rule
RuleTag attaches a tag to a contained Rule object. A tag is a string attached to any Rule entity. The tag does not affect the recognition of a RuleGrammar in which it is used. Instead tags are used to embed information into a grammar that helps with processing of recognition results. Tags are The tag string in the Java Speech Grammar Format allows the backslash character to escape the curly brace character '}' or backslash. The RuleTag class assumes that all such string handling is handled separately. The exception is toString which is required to produce a JSGF-compliant string, and so escapes special characters as required. An empty tag in JSGF is "{}". This tag is defined to be the zero-length string, "". A null tag is converted to a zero-length string.

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

Field Summary
Rule rule
          The tagged rule.
String tag
          The tag string for the rule.
 
Constructor Summary
RuleTag(Rule rule, String tag)
          Construct a RuleTag with for Rule object with a tag string.
RuleTag()
          Empty constructor sets the rule and tag to null.
 
Method Summary
Rule copy()
          Return a deep copy of this rule.
Rule getRule()
          Returns the Rule object being tagged.
String getTag()
          Returns the tag string.
void setRule(Rule rule)
          Set the Rule object to be tagged.
void setTag(String tag)
          Set the tag string for the Rule.
String toString()
          Return a String representing the RuleTag 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 tagged rule.

See Also:
getRule

tag

protected String tag
The tag string for the rule.

See Also:
getTag
Constructor Detail

RuleTag

public RuleTag(Rule rule,
               String tag)
Construct a RuleTag with for Rule object with a tag string. The method assumes that pre-processing of JSGF tags is complete (the leading and trailing curly braces are removed, escape characters are removed).

Parameters:
rule - the rule being tagged
tag - the tag string

RuleTag

public RuleTag()
Empty constructor sets the rule and tag to null.
Method Detail

getRule

public Rule getRule()
Returns the Rule object being tagged.

setRule

public void setRule(Rule rule)
Set the Rule object to be tagged.

getTag

public String getTag()
Returns the tag string.

setTag

public void setTag(String tag)
Set the tag string for the Rule. A zero-length string is legal. A null tag is converted to "".

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 RuleTag object in partial Java Speech Grammar Format.

Any backslash or closing angle brackets within the tag will be properly escaped by a backslash. If required, the rule contained within the RuleTag will enclosed by parentheses.

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