1
2 /******************************************************
3 * Presage, an extensible predictive text entry system
4 * ---------------------------------------------------
5 *
6 * Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 **********(*)*/
23
24
25 #include "predictorsTestMockObjects.h"
26
27
28 ////////////////////////////
29 // Mock HistoryTracker class
30
ContextTracker(Configuration * config,PredictorRegistry * predictorRegistry,PresageCallback * callback,const char wc[],const char sc[],const char bc[],const char cc[])31 ContextTracker::ContextTracker(Configuration* config,
32 PredictorRegistry* predictorRegistry,
33 PresageCallback* callback,
34 const char wc[],
35 const char sc[],
36 const char bc[],
37 const char cc[])
38 : logger ("MockContextTracker", std::cerr),
39 dispatcher (this)
40 {
41 const char** history = (const char**) config;
42 wordChars = history[2]; // getPrefix()
43 separatorChars = history[1]; // getToken(1)
44 blankspaceChars = history[0]; // getToken(2)
45 }
46
~ContextTracker()47 ContextTracker::~ContextTracker()
48 {}
49
update()50 void ContextTracker::update()
51 {}
52
getPrefix() const53 std::string ContextTracker::getPrefix() const
54 {
55 return wordChars;
56 }
57
getToken(const int index) const58 std::string ContextTracker::getToken(const int index) const
59 {
60 std::string result;
61 switch (index) {
62 case 0:
63 result = wordChars;
64 break;
65 case 1:
66 result = separatorChars;
67 break;
68 case 2:
69 result = blankspaceChars;
70 break;
71 default:
72 break;
73 }
74 return result;
75 }
76
getExtraTokenToLearn(const int index,const std::vector<std::string> & change) const77 std::string ContextTracker::getExtraTokenToLearn(const int index, const std::vector<std::string>& change) const
78 { std::string result; return result; }
79
getFutureStream() const80 std::string ContextTracker::getFutureStream() const
81 { std::string result; return result; }
82
getPastStream() const83 std::string ContextTracker::getPastStream() const
84 { std::string result; return result; }
85
getWordChars() const86 std::string ContextTracker::getWordChars() const
87 { std::string result; return result; }
88
getSeparatorChars() const89 std::string ContextTracker::getSeparatorChars() const
90 { std::string result; return result; }
91
getBlankspaceChars() const92 std::string ContextTracker::getBlankspaceChars() const
93 { std::string result; return result; }
94
getControlChars() const95 std::string ContextTracker::getControlChars() const
96 { std::string result; return result; }
97
toString() const98 std::string ContextTracker::toString() const
99 { std::string result; return result; }
100
isWordChar(const char) const101 bool ContextTracker::isWordChar (const char) const
102 { return true; }
103
isSeparatorChar(const char) const104 bool ContextTracker::isSeparatorChar (const char) const
105 { return true; }
106
isControlChar(const char) const107 bool ContextTracker::isControlChar (const char) const
108 { return true; }
109
isBlankspaceChar(const char) const110 bool ContextTracker::isBlankspaceChar(const char) const
111 { return true; }
112
update(const Observable * variable)113 void ContextTracker::update (const Observable* variable)
114 { /* intentionally empty */ }
115