1
// Element_RelevanceProvider.cs
3
// GNOME Do is the legal property of its developers. Please refer to the
4
// COPYRIGHT file distributed with this source distribution.
6
// This program is free software: you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation, either version 3 of the License, or
9
// (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program. If not, see <http://www.gnu.org/licenses/>.
28
/// Relevance related extension methods on Element class.
30
public static class Element_RelevanceProvider
33
static readonly IRelevanceProvider provider = RelevanceProvider.DefaultProvider;
36
/// Increase the relevance of receiver for string match and other Element.
38
/// <param name="self">
39
/// A <see cref="Element"/> whose relevance is to be increased.
41
/// <param name="match">
42
/// A <see cref="System.String"/> of user input for which the receiver should become more relevant.
44
/// <param name="other">
45
/// A <see cref="Element"/> (maybe null) context.
47
public static void IncreaseRelevance (this Element self, string match, Element other)
49
provider.IncreaseRelevance (self, match, other);
53
/// Decrease the relevance of receiver for string match and other Element.
55
/// <param name="self">
56
/// A <see cref="Element"/> whose relevance is to be increased.
58
/// <param name="match">
59
/// A <see cref="System.String"/> of user input for which the receiver should become less relevant.
61
/// <param name="other">
62
/// A <see cref="Element"/> (maybe null) context.
64
public static void DecreaseRelevance (this Element self, string match, Element other)
66
provider.DecreaseRelevance (self, match, other);
70
/// Simply retrieves the receivers relevance and updates the receivers state
71
/// (Element.Relevance is set).
73
/// <param name="self">
74
/// A <see cref="Element"/> whose relevance should be updated to reflect
75
/// the state of the world.
77
/// <param name="match">
78
/// A <see cref="System.String"/> to retrieve relevance info for.
80
/// <param name="other">
81
/// A <see cref="Element"/> (maybe null) to retrieve relevance info for.
83
public static void UpdateRelevance (this Element self, string match, Element other)
85
self.Relevance = provider.GetRelevance (self, match, other);