JSAPI 2.0

javax.speech.recognition
Class RuleSequence

Object
  extended by RuleComponent
      extended by RuleSequence

public class RuleSequence
extends RuleComponent

Specifies a RuleComponent composed of a sequence of sub-RuleComponents that must each be spoken in sequence order. If there are zero RuleComponents in the sequence, the sequence behaves the same as NULL.

See Also:
NULL

Constructor Summary
RuleSequence(RuleComponent[] ruleComponents)
          Constructs a RuleSequence with a sequence of RuleComponents.
RuleSequence(String[] tokens)
          Constructs a RuleSequence from a sequence of Strings converted to a sequence of RuleTokens.
 
Method Summary
 RuleComponent[] getRuleComponents()
          Returns the array of RuleComponents that defines this sequence.
 String toString()
          Returns a String representing this RuleComponent as grammar text.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuleSequence

public RuleSequence(String[] tokens)
Constructs a RuleSequence from a sequence of Strings converted to a sequence of RuleTokens.

A String containing multiple words (e.g. "San Francisco") is treated as a single token in a RuleToken. If appropriate, an application should parse a String sequence element into separate RuleTokens to create a corresponding RuleSequence as an element within the resulting RuleSequence.

A zero-length tokens list results in a zero-length RuleSequence that is equivalent to NULL.

Parameters:
tokens - a sequence of Strings converted to RuleTokens
Throws:
IllegalArgumentException - if null tokens
See Also:
NULL, RuleToken, getRuleComponents

RuleSequence

public RuleSequence(RuleComponent[] ruleComponents)
Constructs a RuleSequence with a sequence of RuleComponents.

A zero-length ruleComponents list results in a zero-length RuleSequence that is equivalent to NULL.

Parameters:
ruleComponents - a sequence of RuleComponents
Throws:
IllegalArgumentException - if null ruleComponents
See Also:
NULL, getRuleComponents
Method Detail

getRuleComponents

public RuleComponent[] getRuleComponents()
Returns the array of RuleComponents that defines this sequence.

If a zero-length array is returned, this is treated the same as NULL.

Returns:
the RuleComponents in this sequence
See Also:
NULL

toString

public String toString()
Returns a 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.

Note that an empty sequence is represented as NULL.

Overrides:
toString in class RuleComponent
Returns:
printable String representing grammar text.
See Also:
NULL, RuleComponent, Rule

JSAPI 2.0

JavaTM Speech API 2.0, Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.

Free Web Hosting