diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-03 17:22:27 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-04-04 16:36:17 +0200 |
commit | d57ddaefd37e6a19d3a6937fbf9a655dbafcdba5 (patch) | |
tree | 56f50116805e8ae7d2287c934e6ccc073142d0ce /fsa | |
parent | 3dab091fd0ec3ffd71af3e19e55ed3a4437b8d8b (diff) |
Use override
Diffstat (limited to 'fsa')
-rw-r--r-- | fsa/src/alltest/detector_test.cpp | 4 | ||||
-rw-r--r-- | fsa/src/vespa/fsa/fsa.h | 42 | ||||
-rw-r--r-- | fsa/src/vespa/fsa/segmenter.h | 2 | ||||
-rw-r--r-- | fsa/src/vespa/fsa/vectorizer.h | 2 | ||||
-rw-r--r-- | fsa/src/vespa/fsa/wordchartokenizer.h | 6 |
5 files changed, 27 insertions, 29 deletions
diff --git a/fsa/src/alltest/detector_test.cpp b/fsa/src/alltest/detector_test.cpp index 1942c4ba7a6..35307b9054e 100644 --- a/fsa/src/alltest/detector_test.cpp +++ b/fsa/src/alltest/detector_test.cpp @@ -10,11 +10,9 @@ #include <iostream> #include <iomanip> -#include <string> #include <vespa/fsa/fsa.h> #include <vespa/fsa/detector.h> -#include <vespa/fsa/ngram.h> using namespace fsa; @@ -25,7 +23,7 @@ public: void add(const NGram &text, unsigned int from, int length, - const FSA::State &) + const FSA::State &) override { std::cout << "detected: [" << from << "," << from+length-1 << "], '" << text.join(" ",from,length) << "'\n"; diff --git a/fsa/src/vespa/fsa/fsa.h b/fsa/src/vespa/fsa/fsa.h index a508b1eb0f4..8bed0b5f8ba 100644 --- a/fsa/src/vespa/fsa/fsa.h +++ b/fsa/src/vespa/fsa/fsa.h @@ -811,7 +811,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; return State::start(); @@ -825,7 +825,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); return State::delta(in); @@ -842,7 +842,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } @@ -958,7 +958,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _counter = 0; return State::start(); @@ -972,7 +972,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { bool ok = State::delta(in); if(ok) @@ -1075,7 +1075,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _counter = 0; return State::start(); @@ -1090,7 +1090,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool startWord(const std::string &in) + bool startWord(const std::string &in) override { start(); return deltaWord(in); @@ -1106,7 +1106,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool deltaWord(const std::string &in) + bool deltaWord(const std::string &in) override { if(in.length()==0){ return _state!=0; @@ -1275,7 +1275,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { #if ((__GNUG__ == 3 && __GNUC_MINOR__ >= 1) || __GNUG__ > 3) _memory.clear(); @@ -1293,7 +1293,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { bool ok = State::delta(in); if(ok) @@ -1460,7 +1460,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; #if ((__GNUG__ == 3 && __GNUC_MINOR__ >= 1) || __GNUG__ > 3) @@ -1479,7 +1479,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); bool ok = State::delta(in); @@ -1499,7 +1499,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } @@ -1641,7 +1641,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; _counter = 0; @@ -1657,7 +1657,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); bool ok = State::delta(in); @@ -1677,7 +1677,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } @@ -1780,7 +1780,7 @@ public: * @param in Input symbol. * @return True if the resulting state is valid. */ - virtual bool delta(symbol_t in) + bool delta(symbol_t in) override { _hash += _fsa->hashDelta(_state,in); bool ok = State::delta(in); @@ -1830,7 +1830,7 @@ public: * * @return True if the resulting state is valid. */ - virtual bool start() + bool start() override { _hash = 0; _counter = 0; @@ -1846,7 +1846,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool startWord(const std::string &in) + bool startWord(const std::string &in) override { start(); return deltaWord(in); @@ -1862,7 +1862,7 @@ public: * @param in Input word. * @return True if the resulting state is valid. */ - virtual bool deltaWord(const std::string &in) + bool deltaWord(const std::string &in) override { if(in.length()==0){ return _state!=0; @@ -1886,7 +1886,7 @@ public: * * @return Hash value. */ - virtual hash_t hash() const + hash_t hash() const override { return _hash; } diff --git a/fsa/src/vespa/fsa/segmenter.h b/fsa/src/vespa/fsa/segmenter.h index 243629bbaa8..f40f27f522b 100644 --- a/fsa/src/vespa/fsa/segmenter.h +++ b/fsa/src/vespa/fsa/segmenter.h @@ -437,7 +437,7 @@ public: */ void add(const NGram &text, unsigned int from, int length, - const FSA::State &state) + const FSA::State &state) override { (void)text; unsigned int to=from+length; diff --git a/fsa/src/vespa/fsa/vectorizer.h b/fsa/src/vespa/fsa/vectorizer.h index 9e8856191da..21b855e186f 100644 --- a/fsa/src/vespa/fsa/vectorizer.h +++ b/fsa/src/vespa/fsa/vectorizer.h @@ -496,7 +496,7 @@ private: */ void add(const NGram &text, unsigned int from, int length, - const FSA::State &state) + const FSA::State &state) override { ItemMap::iterator pos; std::string str = text.join(" ",from,length); diff --git a/fsa/src/vespa/fsa/wordchartokenizer.h b/fsa/src/vespa/fsa/wordchartokenizer.h index c66c727207f..a23dfb9e7f5 100644 --- a/fsa/src/vespa/fsa/wordchartokenizer.h +++ b/fsa/src/vespa/fsa/wordchartokenizer.h @@ -84,7 +84,7 @@ public: * @param text Input text. * @return True on success. */ - virtual bool init(const std::string &text); + bool init(const std::string &text) override; /** @@ -92,14 +92,14 @@ public: * * @return True if there are more tokens. */ - virtual bool hasMore(); + bool hasMore() override; /** * @brief Get next token. * * @return Next token, or empty string if there are no more tokens left. */ - virtual std::string getNext(); + std::string getNext() override; }; |