1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview Base interface for all speech rule stores.
8 * A speech rule store exposes the minimal set of methods a speech rule
9 * author needs for a particular markup type such as MathML or HTML
10 * (definition). A rule provider also acts as the permanent and authoritative
11 * store for all rules for such markup (lookup).
14 goog.provide('cvox.SpeechRuleStore');
19 cvox.SpeechRuleStore = goog.abstractMethod;
23 * Adds a new speech rule.
24 * @param {cvox.SpeechRule} rule The speech rule to be added.
26 cvox.SpeechRuleStore.prototype.addRule = goog.abstractMethod;
30 * Deletes a speech rule if it exists.
31 * @param {cvox.SpeechRule} rule The speech rule to be deleted.
33 cvox.SpeechRuleStore.prototype.deleteRule = goog.abstractMethod;
37 * Retrieves the first rule satisfying a given predicate.
38 * @param {function(cvox.SpeechRule): boolean} pred A predicate on speech rules.
39 * @return {cvox.SpeechRule} The first speech rule in the store satisfying pred.
41 cvox.SpeechRuleStore.prototype.findRule = goog.abstractMethod;
45 * Retrieves all rules satisfying a given predicate.
46 * @param {function(cvox.SpeechRule): boolean} pred A predicate on speech rules.
47 * @return {Array<cvox.SpeechRule>} All speech rules in the store satisfying
50 cvox.SpeechRuleStore.prototype.findAllRules = goog.abstractMethod;
54 * Retrieves a rule for the given node if one exists.
55 * @param {Node} node A node.
56 * @param {!cvox.SpeechRule.DynamicCstr} dynamic Additional dynamic
57 * constraints. These are matched against properties of a rule.
58 * @return {cvox.SpeechRule} The actions of the speech rule if it exists.
60 cvox.SpeechRuleStore.prototype.lookupRule = goog.abstractMethod;
63 // TODO(sorge): Propagate this documentation *everywhere* once these
64 // args/descriptions are hardened/cleared up.
66 * Defines a new speech rule from given components.
67 * @param {string} name Name of the rule. It does not have to be unique.
68 * @param {string} dynamic Dynamic constraint annotation of the rule.
69 * @param {string} action String version of the speech rule.
70 * @param {string} prec Precondition of the rule.
71 * @param {...string} constr Additional constraints.
72 * @return {cvox.SpeechRule} The newly defined rule.
74 cvox.SpeechRuleStore.prototype.defineRule = goog.abstractMethod;