summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/chromeos/chromevox/speech_rules/speech_rule_store.js
blob: 0ab964ac6420a936e12ed0310da78f8538f6189a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview Base interface for all speech rule stores.
 *
 * A speech rule store exposes the minimal set of methods a speech rule
 * author needs for a particular markup type such as MathML or HTML
 * (definition). A rule provider also acts as the permanent and authoritative
 * store for all rules for such markup (lookup).
 */

goog.provide('cvox.SpeechRuleStore');

/**
 * @interface
 */
cvox.SpeechRuleStore = goog.abstractMethod;


/**
 * Adds a new speech rule.
 * @param {cvox.SpeechRule} rule The speech rule to be added.
 */
cvox.SpeechRuleStore.prototype.addRule = goog.abstractMethod;


/**
 * Deletes a speech rule if it exists.
 * @param {cvox.SpeechRule} rule The speech rule to be deleted.
 */
cvox.SpeechRuleStore.prototype.deleteRule = goog.abstractMethod;


/**
 * Retrieves the first rule satisfying a given predicate.
 * @param {function(cvox.SpeechRule): boolean} pred A predicate on speech rules.
 * @return {cvox.SpeechRule} The first speech rule in the store satisfying pred.
 */
cvox.SpeechRuleStore.prototype.findRule = goog.abstractMethod;


/**
 * Retrieves all rules satisfying a given predicate.
 * @param {function(cvox.SpeechRule): boolean} pred A predicate on speech rules.
 * @return {Array<cvox.SpeechRule>} All speech rules in the store satisfying
 *     pred.
 */
cvox.SpeechRuleStore.prototype.findAllRules = goog.abstractMethod;


/**
 * Retrieves a rule for the given node if one exists.
 * @param {Node} node A node.
 * @param {!cvox.SpeechRule.DynamicCstr} dynamic Additional dynamic
 *     constraints. These are matched against properties of a rule.
 * @return {cvox.SpeechRule} The actions of the speech rule if it exists.
 */
cvox.SpeechRuleStore.prototype.lookupRule = goog.abstractMethod;


// TODO(sorge): Propagate this documentation *everywhere* once these
// args/descriptions are hardened/cleared up.
/**
 * Defines a new speech rule from given components.
 * @param {string} name Name of the rule. It does not have to be unique.
 * @param {string} dynamic Dynamic constraint annotation of the rule.
 * @param {string} action String version of the speech rule.
 * @param {string} prec Precondition of the rule.
 * @param {...string} constr Additional constraints.
 * @return {cvox.SpeechRule} The newly defined rule.
 */
cvox.SpeechRuleStore.prototype.defineRule = goog.abstractMethod;